I have a html form which will create an instance of a model plus its  
m2m relations. So you have something like:

MainModelField1
MainModelField2
MainModelField3
...
m2mModelField1a, m2mModelField1b, m2mModelField1c
m2mModelField2a, m2mModelField2b, m2mModelField2c
...
hidden_count
<submit> <add another m2m Model>

In my view I have code like this:
count = <base number>
m2ms = []
for i in count:
     m2ms.append(m2mModelForm(request.POST, prefix="m2m%d" % i)
main_model_form = MainModelForm(request.POST)

The issue comes when I try to validate the forms. Clearly some of the  
m2m model forms may be empty and this is OK as long as at least some  
(one) of them has data. However the is_valid() will fail since there  
are indeed required fields that are not populated.

My question is how do I differentiate between an invalid form object,  
i.e. one with incomplete data versus one with NO data? I tried  
looking at m2ms[i].data but it has ALL of the fields from  
request.POST so it is not {} as expected. What am I missing?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to