When I use CBVs, I nearly always end up needing to mix different types in 
the same view, e.g. detail view and list view, list view and modelform 
view, etc. I really like CBVs but I feel this is the one shortcoming that I 
constantly run into that makes CBVs much less flexible and helpful than 
they could be.

Current CBVs don't have built-in support for this because instance 
variables and methods have the same name, e.g. self.model, self.object in 
both detail view and model form view, get_context_data in all CBVs, and so 
on. I think it would be very useful to modify CBVs to make them combinable 
by using different variable and method names and having separate unified 
methods that combine data from specific methods: you'd have 
self.detail_object, self.modelform_object, get_detail_context_data, and 
get_context_data would check if get_detail_context_data (and other methods) 
exist and get data from all of them and return combined into one dictionary.

It seems like it may be quite a bit of work, and I don't have much 
experience designing many levels of classes with Mixins, I'd like some 
advice on whether this is a good idea and how to implement it. Any 
suggestions / hints appreciated!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/t4bjuYpfuhIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to