dabapps/django-zen-queries

Document how to use with Django class-based views

j4mie opened this issue · 4 comments

j4mie commented

We provide mixins for REST framework views, why not also for Django's built-in generic views?

j4mie commented

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

j4mie commented

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" 🤦‍♂️, which I realise we already have anyway