[Answer]-Adding inline formsets without javascript



a) Add in a button with a name and value you wish, and it will be submitted as POST data, with the key in the POST being the name, and the value the value.

<input type="submit" value="true" name="add">

Read up on HTTPRequest objects in Django here.

b) No. The example uses an inlineformset_factory. This sets the TOTAL_FORMS value for you on POSTing, using the given prefix β€˜prim’. They are taking a copy of the current TOTAL_FORMS count, and adding 1, then returning a new formset.

c) prim is defined in the initial formset, and you are ensuring you are returning a new one with the same prefix. This code is if the form is submitted, so you know β€˜prim’ has been set to the prefix.

d) Yes!

Leave a comment