@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,
}
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 = ''