1π
β
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!
π€professorDante
Source:stackexchange.com