return only topics belonging to participation site

This commit is contained in:
Élie Bouttier 2016-07-11 22:56:25 +02:00
parent 25c15440d2
commit 28f7fb782c
3 changed files with 8 additions and 3 deletions

View File

@ -73,4 +73,9 @@ class Participation(PonyConfModel):
return self.user.is_superuser or self.orga
def is_staff(self):
return self.is_orga() or self.user.topic_set.exists()
return self.is_orga() or self.topic_set.exists()
@property
def topic_set(self):
from proposals.models import Topic
return Topic.objects.filter(site=self.site, reviewers=self.user)

View File

@ -26,7 +26,7 @@
<td><a href="{{ participation.get_absolute_url }}">{{ participation.user.username }}</a></td>
<td>{{ participation.user.get_full_name }}</td>
<td>{{ participation.is_orga|yesno:"✔,✘" }}</td>
<td>{% for topic in participation.user.topic_set.all %}{{ topic.get_link }}{% if not forloop.last %},
<td>{% for topic in participation.topic_set.all %}{{ topic.get_link }}{% if not forloop.last %},
{% endif %}{% endfor %}</td>
<td>
<a href="{% url 'conversation' participation.user.username %}" data-toggle="tooltip" data-placement="bottom"

View File

@ -16,4 +16,4 @@ def is_staff(request, user):
def can_edit_profile(request, profile):
editor = request.user.participation_set.get(site=get_current_site(request))
return editor.is_orga() or editor.user.topic_set.filter(talk__speakers=profile.user).exists()
return editor.is_orga() or editor.topic_set.filter(talk__speakers=profile.user).exists()