Django: Adding inline formset rows without javascript

Posted by Brant on Stack Overflow See other posts from Stack Overflow or by Brant
Published on 2010-03-15T17:06:29Z Indexed on 2010/03/15 17:09 UTC
Read the original article Hit count: 587

This post relates to this: http://stackoverflow.com/questions/520421/add-row-to-inlines-dynamically-in-django-admin

Is there a way to achive adding inline formsets WITHOUT using javascript? Obviously, there would be a page-refresh involved.

So, if the form had a button called 'add'...

I figured I could do it like this:

if request.method=='POST':
  if 'add' in request.POST:
    PrimaryFunctionFormSet = inlineformset_factory(Position,Function,extra=1)
    prims = PrimaryFunctionFormSet(request.POST)

Which I thought would add 1 each time, then populate the form with the post data. However, it seems that the extra=1 does not add 1 to the post data.

© Stack Overflow or respective owner

Related posts about django

Related posts about python