Make admin members
This commit is contained in:
parent
b1a52cc872
commit
b8876ba023
3 changed files with 7 additions and 6 deletions
|
@ -112,6 +112,10 @@ class Organization(models.Model):
|
||||||
def get_contests_url(self):
|
def get_contests_url(self):
|
||||||
return reverse("organization_contests", args=(self.id, self.slug))
|
return reverse("organization_contests", args=(self.id, self.slug))
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
self.members.add(*self.admins.all())
|
||||||
|
super(Organization, self).save(*args, **kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["name"]
|
ordering = ["name"]
|
||||||
permissions = (
|
permissions = (
|
||||||
|
|
|
@ -151,11 +151,8 @@ class OrganizationList(TitleMixin, ListView, OrganizationBase):
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(OrganizationList, self).get_context_data(**kwargs)
|
context = super(OrganizationList, self).get_context_data(**kwargs)
|
||||||
context["my_organizations"] = set()
|
if self.request.profile:
|
||||||
|
context["my_organizations"] = self.request.profile.organizations.all()
|
||||||
for organization in context["organizations"]:
|
|
||||||
if self.can_edit_organization(organization) or self.is_member(organization):
|
|
||||||
context["my_organizations"].add(organization)
|
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{% for user in top_rated %}
|
{% for user in top_rated %}
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding: 7px 2px"><b>{{loop.index}}</b></td>
|
<td style="padding: 7px 2px"><b>{{loop.index}}</b></td>
|
||||||
<td>{{link_user(user)}}</td>
|
<td style="line-break: anywhere">{{link_user(user)}}</td>
|
||||||
<td>{{user.rating}}</td>
|
<td>{{user.rating}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in a new issue