mirror of
https://github.com/umap-project/umap.git
synced 2025-05-05 06:01:48 +02:00
#3 - Edit download url path
This commit is contained in:
parent
fcd238c8a3
commit
42480815fa
2 changed files with 4 additions and 9 deletions
|
@ -81,9 +81,9 @@ i18n_urls += decorated_patterns(
|
||||||
name="datalayer_version",
|
name="datalayer_version",
|
||||||
),
|
),
|
||||||
re_path(
|
re_path(
|
||||||
r"^datalayer/download/(?P<pk>[\d]+)/(?P<name>[_\w]+.geojson)$",
|
r"^datalayer/download/(?P<pk>[\d]+)$",
|
||||||
views.DataLayerDownloadVersion.as_view(),
|
views.DataLayerDownloadVersion.as_view(),
|
||||||
name="datalayer_version",
|
name="datalayer_download",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
i18n_urls += decorated_patterns(
|
i18n_urls += decorated_patterns(
|
||||||
|
|
|
@ -735,14 +735,9 @@ class DataLayerVersion(DataLayerView):
|
||||||
|
|
||||||
class DataLayerDownloadVersion(DataLayerView):
|
class DataLayerDownloadVersion(DataLayerView):
|
||||||
def render_to_response(self, context, **response_kwargs):
|
def render_to_response(self, context, **response_kwargs):
|
||||||
|
|
||||||
|
|
||||||
filename = os.path.basename(self.path)
|
|
||||||
|
|
||||||
with open(self.path, 'rb') as f:
|
with open(self.path, 'rb') as f:
|
||||||
response = HttpResponse(f, content_type='application/geo+json')
|
response = HttpResponse(f, content_type='application/geo+json')
|
||||||
|
response['Content-Disposition'] = f'attachment; filename="{os.path.basename(self.path)}"'
|
||||||
response['Content-Disposition'] = f'attachment; filename="{filename}"'
|
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue