diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html b/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html index 40ab138..36b2bd5 100644 --- a/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html +++ b/src/fellchensammlung/templates/fellchensammlung/details/detail_adoption_notice.html @@ -5,10 +5,12 @@ {% block content %}

{{ adoption_notice.name }}

- {% translate 'Foto hinzufügen' %} - {% translate 'Bearbeiten' %} + {% if has_edit_permission %} + {% translate 'Foto hinzufügen' %} + {% translate 'Bearbeiten' %} + {% endif %}
diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index 92f5f1c..f59a20e 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -67,6 +67,7 @@ def change_language(request): def adoption_notice_detail(request, adoption_notice_id): adoption_notice = AdoptionNotice.objects.get(id=adoption_notice_id) + has_edit_permission = user_is_owner_or_trust_level(request.user, adoption_notice) if request.method == 'POST': if request.user.is_authenticated: comment_form = CommentForm(request.POST) @@ -95,7 +96,7 @@ def adoption_notice_detail(request, adoption_notice_id): raise PermissionDenied else: comment_form = CommentForm(instance=adoption_notice) - context = {"adoption_notice": adoption_notice, "comment_form": comment_form, "user": request.user} + context = {"adoption_notice": adoption_notice, "comment_form": comment_form, "user": request.user, "has_edit_permission": has_edit_permission} return render(request, 'fellchensammlung/details/detail_adoption_notice.html', context=context)