talks visible only by speakers and reviewers

This commit is contained in:
Guilhem Saurel 2016-06-25 15:40:18 +02:00
parent f78ae64711
commit 445fc6bc71
2 changed files with 9 additions and 5 deletions

View File

@ -6,12 +6,14 @@
<a class="btn btn-success" href="{% url 'add-talk' %}">Propose a talk</a>
{% if my_talks %}
<div class="h3">My participing talks:</div>
{% include "proposals/_talk_list.html" with talk_list=my_talks %}
{% endif %}
{% include "proposals/_talk_list.html" with talk_list=my_talks%}
{% if other_talks %}
<div class="h3">Others talks:</div>
{% include "proposals/_talk_list.html" with talk_list=other_talks%}
{% include "proposals/_talk_list.html" with talk_list=other_talks %}
{% endif %}
{% endblock %}

View File

@ -8,6 +8,7 @@ from django.shortcuts import get_object_or_404, redirect, render
from django.views.generic import CreateView, DetailView, ListView
from accounts.mixins import StaffRequiredMixin
from accounts.models import Participation
from proposals.forms import TalkForm
from proposals.models import Speech, Talk, Topic
@ -20,9 +21,10 @@ def home(request):
@login_required
def talk_list(request):
participation = Participation.on_site.get(user=request.user)
return render(request, 'proposals/talks.html', {
'my_talks': Talk.on_site.filter(speakers=request.user),
'other_talks': Talk.on_site.exclude(speakers=request.user),
'other_talks': Talk.on_site.exclude(speakers=request.user).filter(topics__reviewers=participation),
})