Fixing warning when testing (unordered list in pagination)

This commit is contained in:
Leonhard Strohmidel 2022-09-25 18:03:48 +02:00
parent bc0ace7bf3
commit e60a6ea9be

View File

@ -88,15 +88,15 @@ class Explorer(models.Model):
and the list views and the list views
''' '''
if self.user.is_superuser: if self.user.is_superuser:
return Place.objects.filter(mode='live') return Place.objects.filter(mode='live').order_by('submitted_when')
return Place.objects.filter( return (Place.objects.filter(
level__lte=self.level, level__lte=self.level,
mode='live' mode='live'
) | Place.objects.filter( ) | Place.objects.filter(
submitted_by=self, submitted_by=self,
mode='live' mode='live'
) )).order_by('submitted_when')
def get_places_eligible_to_see(self): def get_places_eligible_to_see(self):
if self.user.is_superuser: if self.user.is_superuser:
@ -110,6 +110,12 @@ class Explorer(models.Model):
place in self.get_places_eligible_to_see() place in self.get_places_eligible_to_see()
) )
def get_drafts(self):
return Place.objects.filter(
submitted_by=self,
mode='draft'
)
def __str__(self): def __str__(self):
return self.user.username return self.user.username