Is it possible to have a variable number of fields using django forms?
The specific application is this:
A user can upload as many pictures as they want on t
If you run
python manage.py shell
and type:
from app.forms import PictureForm
p = PictureForm()
p.fields
type(p.fields)
you'll see that p.fields is a SortedDict. you just have to insert a new field. Something like
p.fields.insert(len(p.fields)-2, 'fieldname', Field())
In this case it would insert before the last field, a new field. You should now adapt to your code.
Other alternative is to make a for/while loop in your template and do the form in HTML, but django forms rock for some reason, right?