diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index d0cca0a..ad8ff94 100644
a
|
b
|
class ModelAdmin(BaseModelAdmin):
|
329 | 329 | from django.contrib.admin.models import LogEntry, ADDITION |
330 | 330 | from django.contrib.contenttypes.models import ContentType |
331 | 331 | opts = model._meta |
332 | | new_object = form.save(commit=True) |
333 | | |
334 | | if formsets: |
335 | | for formset in formsets: |
336 | | # HACK: it seems like the parent obejct should be passed into |
337 | | # a method of something, not just set as an attribute |
338 | | formset.instance = new_object |
339 | | formset.save() |
| 332 | new_object = self.save_add_form(request=request, model=model, form=form, formsets=formsets) |
340 | 333 | |
341 | 334 | pk_value = new_object._get_pk_val() |
342 | 335 | LogEntry.objects.log_action(request.user.id, ContentType.objects.get_for_model(model).id, pk_value, force_unicode(new_object), ADDITION) |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
378 | 371 | from django.contrib.admin.models import LogEntry, CHANGE |
379 | 372 | from django.contrib.contenttypes.models import ContentType |
380 | 373 | opts = model._meta |
381 | | new_object = form.save(commit=True) |
| 374 | new_object = self.save_change_form(request=request, model=model, form=form, formsets=formsets) |
382 | 375 | pk_value = new_object._get_pk_val() |
383 | 376 | |
384 | | if formsets: |
385 | | for formset in formsets: |
386 | | formset.save() |
387 | 377 | |
388 | 378 | # Construct the change message. TODO: Temporarily commented-out, |
389 | 379 | # as manipulator object doesn't exist anymore, and we don't yet |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
417 | 407 | request.user.message_set.create(message=msg) |
418 | 408 | return HttpResponseRedirect("../") |
419 | 409 | save_change = transaction.commit_on_success(save_change) |
| 410 | |
| 411 | def save_add_form(self, request, model, form, formsets): |
| 412 | new_object = form.save(commit=True) |
| 413 | |
| 414 | if formsets: |
| 415 | for formset in formsets: |
| 416 | formset.instance = new_object |
| 417 | formset.save() |
| 418 | |
| 419 | return new_object |
| 420 | |
| 421 | def save_change_form(self, request, model, form, formsets): |
| 422 | new_object = form.save(commit=True) |
| 423 | |
| 424 | if formsets: |
| 425 | for formset in formsets: |
| 426 | formset.save() |
| 427 | |
| 428 | return new_object |
420 | 429 | |
421 | 430 | def render_change_form(self, request, model, context, add=False, change=False, form_url='', obj=None): |
422 | 431 | opts = model._meta |