CreateUpdateView view class
|Reported by:||adi.andreias@…||Owned by:||nobody|
|Severity:||Normal||Keywords:||CBV class based view update create CreateUpdateView|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I think it makes sense to have a Class-based view for both updating and creating model objects.
BaseUpdateView and BaseCreateView differ by just two lines, one in get() and one in post():
A CreateUpdateView view would distinguish between create and update based on a slug, pk or similar (configurable?) parameter in url.
There are situations where the view class contains a lot of code logic (like a secondary formset, ajax requests handled along with regular requests, etc.) and having separate classes for create and update would result in duplicate code.
I also think this is a common pattern and deserves to be added to Django core.
Change History (6)
Changed 15 months ago by adi.andreias@…
comment:1 Changed 15 months ago by maxocub
- Cc maxime.turcotte@… added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:4 Changed 15 months ago by erikr
- Resolution set to wontfix
- Status changed from new to closed