Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


BaseGenericInlineFormSet does not use form's save() method #11

wants to merge 1 commit into from

2 participants


Saving a BaseGenericInlineFormSet through the form instead of the model directly. Same patch that attached on ticket


This could use a test, and probably a note in the documentation.


Thanks for the tip, I'll try to add something more.

@pablorecio pablorecio closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 28, 2012
  1. @pablorecio
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 6 deletions.
  1. +5 −6 django/contrib/contenttypes/
11 django/contrib/contenttypes/
@@ -412,12 +412,11 @@ def get_default_prefix(cls):
def save_new(self, form, commit=True):
# Avoid a circular import.
from django.contrib.contenttypes.models import ContentType
- kwargs = {
- self.ct_field.get_attname(): ContentType.objects.get_for_model(self.instance).pk,
- self.ct_fk_field.get_attname():,
- }
- new_obj = self.model(**kwargs)
- return save_instance(form, new_obj, commit=commit)
+ setattr(form.instance, self.ct_field.get_attname(),
+ ContentType.objects.get_for_model(self.instance).pk)
+ setattr(form.instance, self.ct_fk_field.get_attname(),
+ return
def generic_inlineformset_factory(model, form=ModelForm,
Something went wrong with that request. Please try again.