#10331: Using model InlineFormset created with inlineformset_factory fails with KeyError -----------------------------------------------+---------------------------- Reporter: Thomas Presthus <[email protected]> | Owner: nobody Status: new | Milestone: Component: Forms | Version: SVN Keywords: | Stage: Unreviewed Has_patch: 1 | -----------------------------------------------+---------------------------- The following code would fail with '''KeyError''' '' 'user' '' at ''django/forms/models.py in add_fields, line 507'' {{{ from django.contrib.auth.models import User from foo.models import InfoEntry
user = User.objects.get(pk=1) InfoEntryFormset = inlineformset_factory(User, InfoEntry) formset = InfoEntryFormset(instance=user) }}} It seems BaseInlineFormSet tries to access form.fields[self.fk.name] before it is created. Attached is a patch against r9885 fixing this, but should probably be better investigated. -- Ticket URL: <http://code.djangoproject.com/ticket/10331> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---
