#13950: Add "post save" hook to ModelAdmin class
-------------------------------------------+--------------------------------
          Reporter:  3point2               |         Owner:  pandres
            Status:  closed                |     Milestone:         
         Component:  django.contrib.admin  |       Version:  1.2    
        Resolution:  wontfix               |      Keywords:         
             Stage:  Unreviewed            |     Has_patch:  1      
        Needs_docs:  1                     |   Needs_tests:  1      
Needs_better_patch:  1                     |  
-------------------------------------------+--------------------------------
Changes (by kmtracey):

  * status:  reopened => closed
  * resolution:  => wontfix

Comment:

 Replying to [comment:3 3point2]:
 > * The inline invoice entries are now saved. At this point, it's no
 longer possible to hook into the save process to calculate the invoice's
 total. The only workaround would be to have each invoice entry update its
 parent invoice's total when it is saved, which will cause a lot of
 unnecessary save() calls on the invoice (one for each entry).

 No, you can override the !ModelAdmin's save_formset (see:
 
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_formset)
 and add whatever code you like after all the inline models have been
 saved.

 >
 > My post_save hook allows the user to call a function *after* the inlines
 have been saved. This allows the total to be calculated using
 invoice.invoiceentry_set.all()

 So does the existing capability of overriding save_formset. I don't see
 why another way is needed.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13950#comment:4>
Django <http://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.

Reply via email to