#42 Restricting Acces to Place requests

This commit is contained in:
2021-10-01 23:41:34 +02:00
parent b607335299
commit 3f4bf9475c
3 changed files with 48 additions and 12 deletions

View File

@@ -85,6 +85,9 @@ class Explorer(models.Model):
def get_places_eligible_to_see(self):
return Place.objects.all().filter(level__lte=self.level)
def is_eligible_to_see(self, place):
return place in self.get_places_eligible_to_see()
def __str__(self):
return self.user.username