#16074: Class-based views clash get_context_data
---------------------+-------------------------------
Reporter: emyller | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: Generic views
Version: 1.3 | Severity: Normal
Keywords: cbv | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
---------------------+-------------------------------
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.
Reference: https://convore.com/django-community/django-13s-
get_context_data/
--
Ticket URL: <https://code.djangoproject.com/ticket/16074>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.