mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-05-19 21:01:58 +00:00
Psycho-rebased branch 80-no-attachment-docs on top of master
This commit is contained in:
commit
af0ffa3e2c
2 changed files with 17 additions and 0 deletions
|
|
@ -16,3 +16,8 @@ another_file_view = ObjectDownloadView.as_view(
|
|||
deserialized_basename_view = ObjectDownloadView.as_view(
|
||||
model=Document,
|
||||
basename_field='basename')
|
||||
|
||||
#: Serve ``file`` attribute of ``Document`` model, inline rather than as attachment
|
||||
inline_file_view = ObjectDownloadView.as_view(
|
||||
model=Document,
|
||||
attachment=False)
|
||||
|
|
|
|||
|
|
@ -61,6 +61,18 @@ Then here is the code to serve "another_file" instead of the default "file":
|
|||
:language: python
|
||||
:lines: 1-5, 10-12
|
||||
|
||||
***********************************************
|
||||
Serving a file inline rather than as a download
|
||||
***********************************************
|
||||
|
||||
If you would prefer to serve a file as an element of an exsting page
|
||||
rather than triggering a download, you can use :attr:`ObjectDownloadView.attachment` to specify
|
||||
that the HTTP Response object should not have the attachment attribute.
|
||||
|
||||
.. literalinclude:: /../demo/demoproject/object/views.py
|
||||
:language: python
|
||||
:lines: 1-5, 20-23
|
||||
|
||||
**********************************
|
||||
Mapping file attributes to model's
|
||||
**********************************
|
||||
|
|
|
|||
Loading…
Reference in a new issue