#26579: Control deep copy depth for 'save as new' in admin with inlines
-------------------------------+-----------------------
     Reporter:  heka27         |      Owner:  nobody
         Type:  New feature    |     Status:  new
    Component:  contrib.admin  |    Version:  1.9
     Severity:  Normal         |   Keywords:  saveasnew
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+-----------------------
 Proposal:

 Add 'save_as' class attribute to all InlineModelAdmin. By default it
 should probably True.

 ModelAdmin could then be modified as followed:

 {{{
     def get_formsets_with_inlines(self, request, obj=None):
         """
         Yields formsets and the corresponding inlines.
         """
         if '_saveasnew' in request.POST:
             inline_instances = [inline_instance for inline_instance in
 self.get_inline_instances(request, obj)
                                 if getattr(inline_instance, 'save_as',
 True)]
         else:
             inline_instances = self.get_inline_instances(request, obj)

         for inline in inline_instances:
             yield inline.get_formset(request, obj), inline

 }}}

 This change will allow you to control the save_as behavior per inline

--
Ticket URL: <https://code.djangoproject.com/ticket/26579>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.316e844f8ef23233f7ae5d92b7179cb3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to