Refs #80 - Changed wording in 'serve file inline' documentation.

This commit is contained in:
Benoît Bryon 2014-03-03 07:11:38 +01:00
parent af0ffa3e2c
commit 8e83ec559f
2 changed files with 17 additions and 5 deletions

View file

@ -17,7 +17,7 @@ deserialized_basename_view = ObjectDownloadView.as_view(
model=Document,
basename_field='basename')
#: Serve ``file`` attribute of ``Document`` model, inline rather than as attachment
#: Serve ``file`` attribute of ``Document`` model, inline (not as attachment).
inline_file_view = ObjectDownloadView.as_view(
model=Document,
attachment=False)

View file

@ -61,18 +61,30 @@ 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
Serving a file inline rather than as attachment
***********************************************
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.
You can setup :attr:`~django_downloadview.views.base.DownloadMixin.attachment`
to make a view serve a file inline rather than as attachment:
* ``attachment`` is ``False``: inline file, which content is displayed inside
the browser, as if it was an element of the current page.
* ``attachment`` is ``True`` (default): attached file, which usually triggers a
download, i.e. the user is prompted to "save the file as ...".
.. literalinclude:: /../demo/demoproject/object/views.py
:language: python
:lines: 1-5, 20-23
.. note::
The actual behaviour client-side depends on browsers and their
configuration.
**********************************
Mapping file attributes to model's
**********************************