Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
Respect My Net
Commits
9b018b3e
Commit
9b018b3e
authored
Mar 30, 2016
by
Okhin
Browse files
Fix #44 using content_type instead of mimetype
parent
bfa47046
Changes
1
Hide whitespace changes
Inline
Side-by-side
bt/views.py
View file @
9b018b3e
...
@@ -284,7 +284,7 @@ class ViolationSearchView(SearchView):
...
@@ -284,7 +284,7 @@ class ViolationSearchView(SearchView):
def
get_attach
(
request
,
id
):
def
get_attach
(
request
,
id
):
f
=
get_object_or_404
(
Attachment
,
pk
=
id
)
f
=
get_object_or_404
(
Attachment
,
pk
=
id
)
wrapper
=
FileWrapper
(
f
.
storage
)
wrapper
=
FileWrapper
(
f
.
storage
)
response
=
HttpResponse
(
wrapper
,
mime
type
=
f
.
type
)
response
=
HttpResponse
(
wrapper
,
content_
type
=
f
.
type
)
response
[
'Content-Disposition'
]
=
'attachment; filename="%s"'
%
f
.
name
response
[
'Content-Disposition'
]
=
'attachment; filename="%s"'
%
f
.
name
response
[
'Content-Length'
]
=
f
.
storage
.
size
response
[
'Content-Length'
]
=
f
.
storage
.
size
return
response
return
response
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment