diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-19 18:40:32 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-19 18:41:04 +0200 |
commit | 80636d8cd2079d43bc69ff041409196798a0cf9b (patch) | |
tree | 86973a6761dfda4b6ccabcc0a5b084e291af6c60 /archaeological_operations/models.py | |
parent | c6522eb812cd6caf6a8d9b776f9941dff8b6252d (diff) | |
download | Ishtar-80636d8cd2079d43bc69ff041409196798a0cf9b.tar.bz2 Ishtar-80636d8cd2079d43bc69ff041409196798a0cf9b.zip |
Django 1.8: simplify ihtaruser management
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 0548c92e4..1ebf462a3 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -573,12 +573,12 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms, return round(float(self.cost) / self.surface, 2) @classmethod - def get_query_owns(cls, user): + def get_query_owns(cls, ishtaruser): return ( - Q(in_charge=user.ishtaruser.person) | - Q(scientist=user.ishtaruser.person) | - Q(collaborators__pk=user.ishtaruser.person.pk) | - Q(history_creator=user)) & Q(end_date__isnull=True) + Q(in_charge=ishtaruser.person) | + Q(scientist=ishtaruser.person) | + Q(collaborators__pk=ishtaruser.person.pk) | + Q(history_creator=ishtaruser.user_ptr)) & Q(end_date__isnull=True) def is_active(self): return not bool(self.end_date) @@ -926,10 +926,10 @@ class OperationSource(Source): self.index) @classmethod - def get_query_owns(cls, user): - return (Q(operation__in_charge=user.ishtaruser.person) | - Q(operation__scientist=user.ishtaruser.person) | - Q(operation__collaborators__pk=user.ishtaruser.person.pk)) \ + def get_query_owns(cls, ishtaruser): + return (Q(operation__in_charge=ishtaruser.person) | + Q(operation__scientist=ishtaruser.person) | + Q(operation__collaborators__pk=ishtaruser.person.pk)) \ & Q(operation__end_date__isnull=True) |