Ticket #11772: modelAdmin_model_modified_hook.diff
File modelAdmin_model_modified_hook.diff, 1.8 KB (added by , 15 years ago) |
---|
-
django/contrib/admin/options.py
562 562 """ 563 563 formset.save() 564 564 565 def model_modified(self, request, changeType): 566 """ 567 A hook to allow actions to happen on the modification of data. 568 569 changeType values: add, change, delete 570 """ 571 pass 572 565 573 def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None): 566 574 opts = self.model._meta 567 575 app_label = opts.app_label … … 736 744 for formset in formsets: 737 745 self.save_formset(request, form, formset, change=False) 738 746 747 self.model_modified(request, 'add') 739 748 self.log_addition(request, new_object) 740 749 return self.response_add(request, new_object) 741 750 else: … … 832 841 for formset in formsets: 833 842 self.save_formset(request, form, formset, change=True) 834 843 844 self.model_modified(request, 'change') 835 845 change_message = self.construct_change_message(request, form, formsets) 836 846 self.log_change(request, new_object, change_message) 837 847 return self.response_change(request, new_object) … … 1017 1027 self.log_deletion(request, obj, obj_display) 1018 1028 obj.delete() 1019 1029 1030 self.model_modified(request, 'delete') 1020 1031 self.message_user(request, _('The %(name)s "%(obj)s" was deleted successfully.') % {'name': force_unicode(opts.verbose_name), 'obj': force_unicode(obj_display)}) 1021 1032 1022 1033 if not self.has_change_permission(request, None):