Skip to content

Instantly share code, notes, and snippets.

@manevant
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save manevant/5f9a84d4f88c476423dd to your computer and use it in GitHub Desktop.

Select an option

Save manevant/5f9a84d4f88c476423dd to your computer and use it in GitHub Desktop.
Тройное отрицание
if not article.is_visible or not article.is_moderate:
is_author = article.author == request.user
if request.user.is_admin or request.user.is_staff or is_author:
pass
else:
raise PermissionDenied
#EDITED
if not article.is_visible or not article.is_moderate:
is_author = article.author == request.user
if not (request.user.is_admin or request.user.is_staff or is_author):
raise PermissionDenied
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment