Increase limit in owner maps page

fix #651
This commit is contained in:
Yohan Boniface 2019-01-30 12:07:35 +01:00
parent a4c0b31fc9
commit 7a49dcba99

View file

@ -142,11 +142,13 @@ class UserMaps(DetailView, PaginatorMixin):
owner = self.request.user == self.object owner = self.request.user == self.object
manager = Map.objects if owner else Map.public manager = Map.objects if owner else Map.public
maps = manager.filter(Q(owner=self.object) | Q(editors=self.object)) maps = manager.filter(Q(owner=self.object) | Q(editors=self.object))
maps = maps.distinct().order_by('-modified_at')[:50]
if owner: if owner:
per_page = settings.UMAP_MAPS_PER_PAGE_OWNER per_page = settings.UMAP_MAPS_PER_PAGE_OWNER
limit = 100
else: else:
per_page = settings.UMAP_MAPS_PER_PAGE per_page = settings.UMAP_MAPS_PER_PAGE
limit = 50
maps = maps.distinct().order_by('-modified_at')[:limit]
maps = self.paginate(maps, per_page) maps = self.paginate(maps, per_page)
kwargs.update({ kwargs.update({
"maps": maps "maps": maps