diff --git a/umap/static/umap/content.css b/umap/static/umap/content.css index 55fb1c98..3d7a8c2e 100644 --- a/umap/static/umap/content.css +++ b/umap/static/umap/content.css @@ -331,7 +331,7 @@ table.maps .button { margin-bottom: 2px; padding:4px 6px; height: 36px; - line-height: 23px; + line-height: 26px; } /* **************************** */ diff --git a/umap/templates/umap/map_table.html b/umap/templates/umap/map_table.html index 4cd2b12b..84b8c12b 100644 --- a/umap/templates/umap/map_table.html +++ b/umap/templates/umap/map_table.html @@ -45,9 +45,9 @@ - - - {% translate "Download all maps" %} + + + {% translate "Download all these maps" %} diff --git a/umap/views.py b/umap/views.py index 00695b47..423308d5 100644 --- a/umap/views.py +++ b/umap/views.py @@ -307,6 +307,15 @@ user_dashboard = UserDashboard.as_view() class UserDownload(PaginatorMixin, DetailView, SearchMixin): model = User + def is_owner(self): + return self.request.user == self.object + + @property + def per_page(self): + if self.is_owner(): + return settings.UMAP_MAPS_PER_PAGE_OWNER + return settings.UMAP_MAPS_PER_PAGE + def get_object(self): return self.get_queryset().get(pk=self.request.user.pk) @@ -318,10 +327,10 @@ class UserDownload(PaginatorMixin, DetailView, SearchMixin): def render_to_response(self, context, *args, **kwargs): zip_buffer = io.BytesIO() with zipfile.ZipFile(zip_buffer, "a", zipfile.ZIP_DEFLATED, False) as zip_file: - for map_ in self.get_maps(): + for map_ in self.paginate(self.get_maps()): map_geojson = map_.generate_geojson(self.request) geojson_file = io.StringIO(json.dumps(map_geojson)) - file_name = f"umap_backup_{map_.slug}.umap" + file_name = f"umap_backup_{map_.slug}_{map_.pk}.umap" zip_file.writestr(file_name, geojson_file.getvalue()) response = HttpResponse(zip_buffer.getvalue(), content_type="application/zip")