diff options
Diffstat (limited to 'archaeological_operations/models.py')
| -rw-r--r-- | archaeological_operations/models.py | 9 | 
1 files changed, 8 insertions, 1 deletions
| diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index c342fb2a4..9655ca387 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -698,11 +698,18 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,      @classmethod      def get_query_owns(cls, ishtaruser): +        profile = ishtaruser.current_profile +        town_ids = [] +        if profile: +            town_ids = [town['pk'] +                        for town in profile.query_towns.values('pk').all()]          return (              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) +            Q(history_creator=ishtaruser.user_ptr) | +            Q(towns__pk__in=town_ids) +               ) & Q(end_date__isnull=True)      def is_active(self):          return not bool(self.end_date) | 
