django - How to add modelforms dynamically? -
i have simple use case. have 3 models foo, foo1 , foo2. have created model forms them. in page have these forms on page.
problem : user has option click on "add" button. once clicks on able add 1 more foo2 i.e. 1 more foo2 form open or displayed. how should ? i.e. how add modelform dynamically ?
edit:
this can done using jquery. question how differentiate in view ? should use prefix ? i.e. should add dynamic prefix forms being created ?
as rohan says in comments, if have more 1 of same kind of form on page, should using formsets. each form within formset has own prefix includes id can increment javascript.
Comments
Post a Comment