Distinction page document public/privé
This commit is contained in:
parent
c376aea787
commit
0a140eca15
4 changed files with 20 additions and 10 deletions
|
|
@ -45,12 +45,19 @@ class AgendaView(ListView):
|
|||
class MediaView(ListView):
|
||||
model = Document
|
||||
template_name = "media.html"
|
||||
prive = False
|
||||
|
||||
def get_queryset(self):
|
||||
qs = Document.objects.all().order_by("-quand", "titre")
|
||||
if not self.request.user.is_authenticated:
|
||||
qs = qs.filter(prive=False)
|
||||
return qs
|
||||
return Document.objects.filter(prive=self.prive).order_by("-quand", "titre")
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
return {
|
||||
**super().get_context_data(**kwargs),
|
||||
"title": {
|
||||
False: "Enregistrements, photos et vidéos de la chorale",
|
||||
True: "Documents privés",
|
||||
}.get(self.prive)
|
||||
}
|
||||
|
||||
|
||||
class EspaceMembresView(LoginRequiredMixin, TemplateView):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue