There are several questions about more or less same issue in stackoverflow, but none of them seems to cover the issues i can foresee. Since my django knowledege is limited i might be overreacting... so..
What i want to accomplish, with django, is to edit 2 models, List and ListItem in same view. List as common form and listitem as inlineformset. Creating those two forms is not a problem. Passing them into a view > template is not a problem either.
What i am worried about is,
1) How to post them to same address and handle that post request.
2) How to set up adding / removing those inline ListItems from this formset with javascript.
2.1) if i send ajax request to some address to remove ListItem object and then use javascript to remove that part of the form. How will the django view part know, which object to delete from the database? Do i need to pass ID of the object to template, so i can send it back to view with ajax?
2.2) If the whole changed ListItem inline formset gets posted after i have removed/added rows, then wont it cause problems, because the dictionary of objects that was used initially has been changed in between?
3)any other pitfalls someone could see?
Btw i dont want through code examples. If you can, just explain how things work and what i should do and keep in mind. If you know of up to date examples, then i could use some links too.
Edit (and answer to my own questions): I tried it and here is what i found: 1) Just pos them... in view you can do it like this:
form = ListForm(request.POST, instance=l)
formset = ShoppingListFormSet(request.POST, instance=l)
And then do whatever is needed - very simple and easy.
2)Duplicate existing row/form or remove one. All you need to keep in mind is that element names are correct and the stuff that formset loads with {{ form.management_form }} contains up to date and correct information with how many forms there is. All field names also need to be up to date. If you remove form from between forms 1 and 3, then form 3 numbers need to be changed to 2 and so on.
2.1) element id can be extracted from {{ form.initial.id }} and then used in form
2.2) No if form.management_form info is correct and if field names are up to date (see 2.)
3) Just have to build views, so your site will not be ruined by cross site request forgery (see http://docs.djangoproject.com/en/dev/ref/contrib/csrf/)
Alan.