Opened 13 years ago
Closed 12 years ago
#18158 closed Uncategorized (invalid)
Mix FormView with ListView functionality
Reported by: | Evandro Myller | Owned by: | nobody |
---|---|---|---|
Component: | Generic views | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I've been wrestling this for hours and still couldn't figure out how one can mix a FormView
with a ListView
without having to repeat code or writing nasty code pieces.
A very simple use case: Object search view.
Many times we need to combine a simple search form into a ListView
, but there's no straightforward way to do so. What I expected is that inheriting from ListView
and FormView
at once could get me to what I need, but, instead, it clashes on form
/object_list
context variables because of the order of their get
methods.
In my - and many - cases, I need to process the search form - actually a model form, since it comes from a model called SavedSearch
- in order to filter items out, save the search object and whatever else, depending on the form.
I expected that #16074 would fix this. :-(
The generic class based views aren't intended to be arbitrarily combinable blocks. Rather, they're ready-to-use examples for trivial cases. This is explained in the documentation.