Document how to use with Django class-based views
j4mie opened this issue · 4 comments
We provide mixins for REST framework views, why not also for Django's built-in generic views?
Turns out you can just add:
response_class = zen_queries.TemplateResponse
to your ListView
or DetailView
subclasses and it just works!
We could probably stick this in the README.
if that's the case, the response should probably have a better name, as at that point, it's no longer rendering a response.Or a duplicate with similar functionality which knows nothing of templates
I don't think I understand that @RealOrangeOne .. what do you mean?
response_class
is a property (defined on TemplateResponseMixin
) which is used in render_to_response
to determine which response class the CBV should return an instance of. All I'm suggesting is that it just needs to be swapped from the default (django.template.response.TemplateResponse
) to the TemplateResponse
subclass that already comes with zen-queries
.
Why does that imply it needs to be renamed?
aha, I see the problem, I read "generic view" as "DRF generic view"