Ticket #8005: 8005.3.diff
File 8005.3.diff, 1.7 KB (added by , 16 years ago) |
---|
-
django/contrib/admin/options.py
325 325 for inline in self.inline_instances: 326 326 yield inline.get_formset(request, obj) 327 327 328 def pre_save(self, request, instance, is_add): 329 pass 330 331 def post_save(self, request, instance, is_add): 332 pass 333 328 334 def save_add(self, request, form, formsets, post_url_continue): 329 335 """ 330 336 Saves the object in the "add" stage and returns an HttpResponseRedirect. … … 333 339 """ 334 340 from django.contrib.admin.models import LogEntry, ADDITION 335 341 opts = self.model._meta 336 new_object = form.save(commit=True) 337 342 343 new_object = form.save(commit=False) 344 self.pre_save(request, new_object, True) 345 new_object.save() 346 if hasattr(new_object, 'save_m2m'): 347 new_object.save_m2m() 348 self.post_save(request, new_object, True) 349 338 350 if formsets: 339 351 for formset in formsets: 340 352 # HACK: it seems like the parent obejct should be passed into … … 382 394 """ 383 395 from django.contrib.admin.models import LogEntry, CHANGE 384 396 opts = self.model._meta 385 new_object = form.save(commit=True) 397 398 new_object = form.save(commit=False) 399 self.pre_save(request, new_object, False) 400 new_object.save() 401 if hasattr(new_object, 'save_m2m'): 402 new_object.save_m2m() 403 self.post_save(request, new_object, False) 404 386 405 pk_value = new_object._get_pk_val() 387 406 388 407 if formsets: