From e11151858bd38717f50db542838f081bcece7301 Mon Sep 17 00:00:00 2001 From: reverend Date: Sat, 2 Oct 2021 00:03:45 +0200 Subject: [PATCH] #42 Fined tuned list of eligible to see places --- django_lostplaces/lostplaces/models/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/django_lostplaces/lostplaces/models/models.py b/django_lostplaces/lostplaces/models/models.py index 74ca406..286f540 100644 --- a/django_lostplaces/lostplaces/models/models.py +++ b/django_lostplaces/lostplaces/models/models.py @@ -83,7 +83,9 @@ class Explorer(models.Model): ) def get_places_eligible_to_see(self): - return Place.objects.all().filter(level__lte=self.level) + if self.user.is_superuser: + return Place.objects.all() + return Place.objects.all().filter(level__lte=self.level) | self.places.all() def is_eligible_to_see(self, place): return (