Ticket #7888: 7888.diff
File 7888.diff, 821 bytes (added by , 16 years ago) |
---|
-
django/forms/models.py
320 320 if self.model._meta.has_auto_field: 321 321 self._pk_field_name = self.model._meta.pk.attname 322 322 form.fields[self._pk_field_name] = IntegerField(required=False, widget=HiddenInput) 323 elif len(self.model._meta.parents) == 1: 324 self._pk_field_name = self.model._meta.pk.attname 325 form.fields[self._pk_field_name] = IntegerField(required=False, widget=HiddenInput, 326 initial=self.instance.pk) 323 327 super(BaseModelFormSet, self).add_fields(form, index) 324 328 325 329 def modelformset_factory(model, form=ModelForm, formfield_callback=lambda f: f.formfield(),