Merge remote-tracking branch 'origin/develop' into feature/50-Linktypes
This commit is contained in:
@@ -82,6 +82,18 @@ class Explorer(models.Model):
|
||||
choices=EXPLORER_LEVELS
|
||||
)
|
||||
|
||||
def get_places_eligible_to_see(self):
|
||||
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 (
|
||||
self.user.is_superuser or
|
||||
place.submitted_by == self or
|
||||
place in self.get_places_eligible_to_see()
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.user.username
|
||||
|
||||
|
Reference in New Issue
Block a user