Class-based views clash get_context_data
|eMyller@…, Carlos Palol, Reinout van Rees, Danilo Bargen
|Ready for checkin
|Patch needs improvement:
One of the best advantages of class-based views is the possibility to use "mixins". So now I'm trying to have a view that lists some database objects and puts an ordinary search form in the page. All I expect to do is the following:
class MyView(ListView, FormView): model = Model template_name = 'my_template.html' paginate_by = 12 form_class = SearchForm
But the way Django generic views collects data for the context completely misses such goal. We have .get_context_data (among other methods) clashing, so we never get both form and object_list keys.
One suggestion I give is to let the views feed a
self.context_data dict, so it could be far easier to access/modify the context and we wouldn't have such problem.