A
A
admin4eg2012-10-22 10:42:23
Django
admin4eg, 2012-10-22 10:42:23

Complex shapes....?

Have a nice day everyone, little by little I'm tinkering with Django.
Faced such task, there is a lot of step form (FormWizard).
In fact, which fills the model.
… there is a "(scientific) work" model, a work has an author and there are "co-authors", in fact, a
"co-author" is also a model that has PrimaryKey for the "Work" model.
How to organize the filling of the “co-author” model in forms, despite the fact that co-authors can be from 0 to 20?
I don’t even know exactly how to deal with it, or display all 20 forms, but hide them through JS and, by clicking on the “Add more” button, display the next form.
Or maybe add an “Add more” button, it will just show the same form again, but the old data is not lost.
Maybe someone has notes where to see an example of the implementation of such a mechanism?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
barker, 2012-10-22
@barker

This is very easy to do via inlineformset_factory, figure it out. On the client, I added lines using jquery, a dozen lines, no more.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question