On Jul 5, 2009, at 11:32 PM, Matthias Kestenholz wrote:
> > Hi, > > On Sun, Jul 5, 2009 at 11:42 PM, Eric Abrahamsen<gir...@gmail.com> > wrote: >> >> I'm somehow failing to use modelformsets, this is the relevant view >> and error traceback: >> >> http://dpaste.org/evHq/ >> >> I'm validating a whole bunch of forms at the same time, but I don't >> see how that could cause the formset failure. Sample is a model >> with a >> ForeignKey to Author (though the ForeignKey field itself is called >> 'translator', stupid naming practice). I'm hoping there's something >> obviously wrong with what I'm doing there, but I can provide more >> details if necessary... >> > > > It seems that the modelformset code cannot find the primary key values > in the POST request. You need to include the primary key hidden field > in your form code, otherwise it will not work; something like this: > > {% for form in formset %} > {{ form.id }} > {# the rest of your code #} > {% endfor %} > > > I don't recall whether this is documented or not. This approach worked > for me, though. And it worked for me too! That solved the problem – I was looking in the wrong direction completely. It's all documented, I just never paid close attention to the model formset stuff below the section on views. Thanks for dragging me back on track. E > > > > Matthias > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---