#22768: CreateUpdateView view class
-------------------------+-------------------------------------------------
     Reporter:           |      Owner:  nobody
  adi.andreias@…         |     Status:  new
         Type:  New      |    Version:  master
  feature                |   Keywords:  CBV class based view update create
    Component:  Generic  |  CreateUpdateView
  views                  |  Has patch:  0
     Severity:  Normal   |      UI/UX:  0
 Triage Stage:           |
  Unreviewed             |
Easy pickings:  1        |
-------------------------+-------------------------------------------------
 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():
 https://github.com/django/django/blob/1.7b4/django/views/generic/edit.py#L218
 https://github.com/django/django/blob/1.7b4/django/views/generic/edit.py#L195

 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.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22768>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.5384768efbae65446491e3b62ba54c34%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to