-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to not trigger a download #81
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is "attachment" more pertinent than "download" here? |
||
*********************************************** | ||
|
||
If you would prefer to serve a file as an element of an exsting page | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: s/exsting/existing/ |
||
rather than triggering a download, you can use :attr:`ObjectDownloadView.attachment` to specify | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
that the HTTP Response object should not have the attachment attribute. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps additional explanation about inline/attachment could be useful:
Of course, behaviour may change depending on browsers and their configuration. |
||
|
||
.. literalinclude:: /../demo/demoproject/object/views.py | ||
:language: python | ||
:lines: 1-5, 20-23 | ||
|
||
********************************** | ||
Mapping file attributes to model's | ||
********************************** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flake8 reports: "line too long (83 > 79 characters)".
See https://travis-ci.org/benoitbryon/django-downloadview/jobs/18602404#L49
What about
#: Serve ``file`` attribute of ``Document`` model, inline (not as attachment).
Or span the comment on 2 lines :)