diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index ed41c7f..7c7d73d 100644
a
|
b
|
class ModelAdmin(BaseModelAdmin):
|
522 | 522 | else: |
523 | 523 | form_validated = False |
524 | 524 | new_object = self.model() |
525 | | for FormSet in self.get_formsets(request): |
| 525 | for idx, FormSet in enumerate(self.get_formsets(request)): |
526 | 526 | formset = FormSet(data=request.POST, files=request.FILES, |
527 | 527 | instance=new_object, |
528 | | save_as_new=request.POST.has_key("_saveasnew")) |
| 528 | save_as_new=request.POST.has_key("_saveasnew"), |
| 529 | prefix="form-%s" % idx) |
529 | 530 | formsets.append(formset) |
530 | 531 | if all_valid(formsets) and form_validated: |
531 | 532 | self.save_model(request, new_object, form, change=False) |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
547 | 548 | if isinstance(f, models.ManyToManyField): |
548 | 549 | initial[k] = initial[k].split(",") |
549 | 550 | form = ModelForm(initial=initial) |
550 | | for FormSet in self.get_formsets(request): |
551 | | formset = FormSet(instance=self.model()) |
| 551 | for idx, FormSet in enumerate(self.get_formsets(request)): |
| 552 | formset = FormSet(instance=self.model(), prefix="form-%s" % idx) |
552 | 553 | formsets.append(formset) |
553 | 554 | |
554 | 555 | adminForm = helpers.AdminForm(form, list(self.get_fieldsets(request)), self.prepopulated_fields) |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
608 | 609 | else: |
609 | 610 | form_validated = False |
610 | 611 | new_object = obj |
611 | | for FormSet in self.get_formsets(request, new_object): |
| 612 | for idx, FormSet in enumerate(self.get_formsets(request, new_object)): |
612 | 613 | formset = FormSet(request.POST, request.FILES, |
613 | | instance=new_object) |
| 614 | instance=new_object, prefix="form-%s" % idx) |
614 | 615 | formsets.append(formset) |
615 | 616 | |
616 | 617 | if all_valid(formsets) and form_validated: |
… |
… |
class ModelAdmin(BaseModelAdmin):
|
625 | 626 | |
626 | 627 | else: |
627 | 628 | form = ModelForm(instance=obj) |
628 | | for FormSet in self.get_formsets(request, obj): |
629 | | formset = FormSet(instance=obj) |
| 629 | for idx, FormSet in enumerate(self.get_formsets(request, obj)): |
| 630 | formset = FormSet(instance=obj, prefix="form-%s" % idx) |
630 | 631 | formsets.append(formset) |
631 | 632 | |
632 | 633 | adminForm = helpers.AdminForm(form, self.get_fieldsets(request, obj), self.prepopulated_fields) |