mirror of https://gitlab.crans.org/bde/nk20
Display "Create WEI" button only for people that can create a WEI, see #53
This commit is contained in:
parent
9008baad3a
commit
8409ee4cc4
|
@ -54,6 +54,11 @@ class WEIListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
|
||||||
ordering = '-year'
|
ordering = '-year'
|
||||||
extra_context = {"title": _("Search WEI")}
|
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):
|
class WEICreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
<div class="row justify-content-center mb-4">
|
<div class="row justify-content-center mb-4">
|
||||||
<div class="col-md-10 text-center">
|
<div class="col-md-10 text-center">
|
||||||
<input class="form-control mx-auto w-25" type="text" onkeyup="search_field_moved()" id="search_field"/>
|
<input class="form-control mx-auto w-25" type="text" onkeyup="search_field_moved()" id="search_field"/>
|
||||||
<hr>
|
{% if can_create_wei %}
|
||||||
<a class="btn btn-primary text-center my-4" href="{% url 'wei:wei_create' %}">{% trans "Create WEI" %}</a>
|
<hr>
|
||||||
|
<a class="btn btn-primary text-center my-4" href="{% url 'wei:wei_create' %}">{% trans "Create WEI" %}</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
|
Loading…
Reference in New Issue