diff --git a/apps/wei/views.py b/apps/wei/views.py index dde9fe78..f2ac40dc 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -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): """ diff --git a/templates/wei/weiclub_list.html b/templates/wei/weiclub_list.html index 5390ade6..2739e5bf 100644 --- a/templates/wei/weiclub_list.html +++ b/templates/wei/weiclub_list.html @@ -5,8 +5,10 @@
-
- {% trans "Create WEI" %} + {% if can_create_wei %} +
+ {% trans "Create WEI" %} + {% endif %}