From: Jan Szejko Date: Fri, 31 Mar 2017 08:17:50 +0000 (+0200) Subject: minor cleanup X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/4fbd1c359e6f2b8b15536179021a6cb0bc3e390c?hp=7a406f1d8796bbe87390f5d7879318957e425150 minor cleanup --- diff --git a/apps/catalogue/templatetags/document_list.py b/apps/catalogue/templatetags/document_list.py index f9de2d6e..470839a8 100755 --- a/apps/catalogue/templatetags/document_list.py +++ b/apps/catalogue/templatetags/document_list.py @@ -64,11 +64,7 @@ def document_list(context, user=None, organization=None): @register.inclusion_tag('catalogue/book_list/book.html', takes_context=True) def document_short_html(context, doc): user = context['request'].user - if doc.owner_organization is not None: - am_owner = doc.owner_organization.is_member(user) - else: - am_owner = doc.owner_user == user return { - 'am_owner': am_owner, + 'am_owner':doc.can_edit(user), 'book': doc, } diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 1021c878..2e82dfa3 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -353,9 +353,6 @@ def book_owner(request, pk): doc = get_object_or_404(Document, pk=pk, deleted=False) if not doc.can_edit(request.user): return HttpResponseForbidden("Not authorized.") - user_is_owner = doc.owner_organization and doc.owner_organization.is_member(request.user) - if not (doc.owner_user == request.user or user_is_owner): - raise Http404 error = ''