From 80636d8cd2079d43bc69ff041409196798a0cf9b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 19 Apr 2017 18:40:32 +0200 Subject: Django 1.8: simplify ihtaruser management --- archaeological_finds/models_finds.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'archaeological_finds/models_finds.py') diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 6e920bc7d..b4579d4df 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -883,14 +883,14 @@ class Find(ValueGetter, BaseHistorizedItem, ImageModel, OwnPerms, return new @classmethod - def get_query_owns(cls, user): - return (Q(base_finds__context_record__operation__scientist=user. + def get_query_owns(cls, ishtaruser): + return (Q(base_finds__context_record__operation__scientist= ishtaruser.person) | - Q(base_finds__context_record__operation__in_charge=user. + Q(base_finds__context_record__operation__in_charge= ishtaruser.person) | - Q(base_finds__context_record__operation__collaborators__pk=user. + Q(base_finds__context_record__operation__collaborators__pk= ishtaruser.person.pk) | - Q(history_creator=user)) \ + Q(history_creator=ishtaruser.user_ptr)) \ & Q(base_finds__context_record__operation__end_date__isnull=True) @classmethod @@ -1114,13 +1114,13 @@ class FindSource(Source): return self.find @classmethod - def get_query_owns(cls, user): - return (Q(find__base_finds__context_record__operation__scientist=user. + def get_query_owns(cls, ishtaruser): + return (Q(find__base_finds__context_record__operation__scientist= ishtaruser.person) | - Q(find__base_finds__context_record__operation__in_charge=user. + Q(find__base_finds__context_record__operation__in_charge= ishtaruser.person) | Q( - find__base_finds__context_record__operation__collaborators__pk=user. + find__base_finds__context_record__operation__collaborators__pk= ishtaruser.person.pk)) \ & Q( find__base_finds__context_record__operation__end_date__isnull=True) -- cgit v1.2.3