1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-20 17:41:55 +02:00

Display "Create WEI" button only for people that can create a WEI, see #53

This commit is contained in:
Yohann D'ANELLO
2020-07-31 17:15:31 +02:00
parent 9008baad3a
commit 8409ee4cc4
2 changed files with 9 additions and 2 deletions

View File

@ -54,6 +54,11 @@ class WEIListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
ordering = '-year'
extra_context = {"title": _("Search WEI")}
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["can_create_wei"] = PermissionBackend.check_perm(self.request.user, "wei.add_weiclub", WEIClub())
return context
class WEICreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
"""