Skip to content
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

Documentation / ObjectDownloadView without attachment? #80

Closed
quietlyconfident opened this issue Feb 7, 2014 · 3 comments
Closed

Documentation / ObjectDownloadView without attachment? #80

quietlyconfident opened this issue Feb 7, 2014 · 3 comments
Assignees
Labels
Milestone

Comments

@quietlyconfident
Copy link
Contributor

I'd like to create a view which is just like ObjectDownloadView, but returns the response NOT as an attachment. I've been reading the documentation trying to figure out how to do this, and I see how I could do it by copying a lot of code and changing one flag, but it seems that the point of the Make Your Own View section is that it should be possible to do so in a more DRY manner. Maybe the documentation says how to do this but if so, I don't understand it.

Is it possible to change the settings on the DownloadMixin by passing arguments to ObjectDownloadView? Or otherwise possible to create a new view which inherits everything from ObjectDownloadView but changes the attachment value? If someone could explain it to me, I'd be happy to format up the response and propose it for the documentation.

@benoitbryon
Copy link
Collaborator

I'd like to create a view which is just like ObjectDownloadView, but returns the response NOT as an attachment.
[...]
Is it possible to change the settings on the DownloadMixin by passing arguments to ObjectDownloadView? Or otherwise possible to create a new view which inherits everything from ObjectDownloadView but changes the attachment value?

You should be able to set attachment = False either via ObjectDownloadView.as_view():

ObjectDownloadView.as_view(model=Document, attachment=False)

Or in ObjectDownloadView subclass:

class MySpecialObjectDownloadView(ObjectDownloadView):
    attachment = False

If the solutions above do not work, then it is a bug.

I'd be happy to format up the response and propose it for the documentation.

Agreed!

Additional notes about internals:

@benoitbryon
Copy link
Collaborator

Note: this story looks like #75, where documentation is not obvious about DownloadMixin.basename and DownloadMixin.get_basename() usage.

quietlyconfident added a commit to quietlyconfident/django-downloadview that referenced this issue Feb 10, 2014
To be used in documentation for issue jazzband#80
quietlyconfident added a commit to quietlyconfident/django-downloadview that referenced this issue Feb 10, 2014
@benoitbryon benoitbryon added this to the 1.6 milestone Feb 11, 2014
@benoitbryon
Copy link
Collaborator

Tagged as "feature". Planned for next release (1.6).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants