valentin jungbluth
2018-11-12 15:02:04 UTC
Hi guys,
I would like to be able to add dynamically* django forms* in my *formset*
with *Add button*.
I tried to write different things but I don't overcome to get the expected
result up to now.
I have a formset defined in my *forms.py* file :
[image: forms.png]
Then, I created in my *views.py* file this function :
[image: main.png]
Finally, I'm trying to write my *template* file :
[image: html.png]
And I have *javascript function* :
[image: js.png]
I spent lot of time in order to get the expected result but I don't
overcome to get it. S I need your help if you could help me.
I don't want to use another library, but I accept JS, AJAX, JQuery or
Django answers !
The issue is :
It displays the first form, but when I want to add a second one by clicking
on `Add button`, it doesn't create the second one.
So I assume my Django part is good, but not the JS part ?
Thank you by advance
I would like to be able to add dynamically* django forms* in my *formset*
with *Add button*.
I tried to write different things but I don't overcome to get the expected
result up to now.
I have a formset defined in my *forms.py* file :
[image: forms.png]
Then, I created in my *views.py* file this function :
[image: main.png]
Finally, I'm trying to write my *template* file :
[image: html.png]
And I have *javascript function* :
[image: js.png]
I spent lot of time in order to get the expected result but I don't
overcome to get it. S I need your help if you could help me.
I don't want to use another library, but I accept JS, AJAX, JQuery or
Django answers !
The issue is :
It displays the first form, but when I want to add a second one by clicking
on `Add button`, it doesn't create the second one.
So I assume my Django part is good, but not the JS part ?
Thank you by advance
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f2fde589-cd12-4dad-9837-e6b6de4a0d30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f2fde589-cd12-4dad-9837-e6b6de4a0d30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.