I have a specific problem with Django forms that I think should definitely have a solution already written.
I have several different forms that are presented in one view, for example ... (Sorry to just use the pseudocode) ..
class Form1():
<html> <form> {{ 1-instance-Form1 }} {{ 2-instance-Form1 }} {{ 1-instance-Form2 }} {{ 2-instance-Form2 }} </form> </html>
In addition, I want to give the user the opportunity to add a form instance of one of the form classes available through jquery so that the form can become
<html> <form> {{ 1-instance-Form1 }} {{ 2-instance-Form1 }} {{ 1-instance-Form2 }} {{ 2-instance-Form2 }} {{ 3-instance-Form2 }} </form> </html>
Now, when you are looking for a solution to solve such a problem, I came across the concept of Django formset, which, as the documentation describes, is a collection of instances of the same Form class. However, as I see it, forms can be able to handle heterogeneous forms:
With some definitions changed
class BaseHeterogenousFormSet(StrAndUnicode): def append(form):
Is there something wrong with the way I think about this issue?
source share