mirror of
https://github.com/umap-project/umap.git
synced 2025-05-04 21:51:50 +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",
|
||||
),
|
||||
re_path(
|
||||
r"^datalayer/download/(?P<pk>[\d]+)/(?P<name>[_\w]+.geojson)$",
|
||||
r"^datalayer/download/(?P<pk>[\d]+)$",
|
||||
views.DataLayerDownloadVersion.as_view(),
|
||||
name="datalayer_version",
|
||||
name="datalayer_download",
|
||||
),
|
||||
)
|
||||
i18n_urls += decorated_patterns(
|
||||
|
|
|
@ -734,15 +734,10 @@ class DataLayerVersion(DataLayerView):
|
|||
)
|
||||
|
||||
class DataLayerDownloadVersion(DataLayerView):
|
||||
def render_to_response(self, context, **response_kwargs):
|
||||
|
||||
|
||||
filename = os.path.basename(self.path)
|
||||
|
||||
def render_to_response(self, context, **response_kwargs):
|
||||
with open(self.path, 'rb') as f:
|
||||
response = HttpResponse(f, content_type='application/geo+json')
|
||||
|
||||
response['Content-Disposition'] = f'attachment; filename="{filename}"'
|
||||
response['Content-Disposition'] = f'attachment; filename="{os.path.basename(self.path)}"'
|
||||
|
||||
return response
|
||||
|
||||
|
|
Loading…
Reference in a new issue