mirror of
https://github.com/Hopiu/django-rosetta.git
synced 2026-05-05 12:14:41 +00:00
ORM Query refactoring access.py
One query instead of two queries to database.
This commit is contained in:
parent
76e8387f8c
commit
f3a38f5877
1 changed files with 1 additions and 6 deletions
|
|
@ -28,9 +28,4 @@ def is_superuser_staff_or_in_translators_group(user):
|
|||
elif user.is_superuser and user.is_staff:
|
||||
return True
|
||||
else:
|
||||
try:
|
||||
from django.contrib.auth.models import Group
|
||||
translators = Group.objects.get(name='translators')
|
||||
return translators in user.groups.all()
|
||||
except Group.DoesNotExist:
|
||||
return False
|
||||
return user.groups.filter(name="translators").exists()
|
||||
|
|
|
|||
Loading…
Reference in a new issue