They are not getting validated, or validation is failing.
Also, it looks like you are using model forms. You can get rid of all the 
for,.cleaned_data.get lines and just use:

if emet_form.is_valid() and des_form.is_valid() and fich_form.is_valid(): 
      emet = emet_form.save()
      des = des_form.save()
      fich = fich_form.save()

On Tuesday, July 29, 2014 10:53:59 AM UTC-5, Devin Cky wrote:
>
>
>
> On Tuesday, July 29, 2014 1:48:00 PM UTC, Tom Evans wrote:
>>
>> On Tue, Jul 29, 2014 at 12:31 PM, Devin Cky <[email protected]> wrote: 
>> > hi i am a beginner in django and I have a problem .. how can I validate 
>> 3 
>> > forms on the same page simultaneously ..please help me 
>> > 
>>
>> If they are different types of forms, you cannot use a formset. 
>>
>> In that case, just test whether all forms are valid. If they are all 
>> valid, save/process the forms. If not, re-render the page with the 
>> bound forms and display the errors. 
>>
>> Eg 
>>
>> def myview(request): 
>>   if request.method == 'POST': 
>>     form_a = FormA(request.POST) 
>>     form_b = FormB(request.POST) 
>>     form_c = FormC(request.POST) 
>>     if form_a.is_valid() and form_b.is_valid() and form_c.is_valid(): 
>>       form_a.save() 
>>       .... 
>>       return HttpResponseRedirect(...) 
>>   else: 
>>     form_a = FormA() 
>>     form_b = FormB() 
>>     form_c = FormC() 
>>   return render(...) 
>>
>> Cheers 
>>
>> Tom 
>>
>
>
>
>
>
> -------thank you TOM--- 
>   when I submit my forms .. no field is validated
>
>
> .......view.....
>
>
>
> def enregistrer(request):
>         if request.method == 'POST': 
>             emet_form = EmetteurForm(request.POST, prefix = "emet")
>             des_form = DestinataireForm(request.POST, prefix = "des")
>             fich_form = FichierForm(request.POST, prefix = "fich")
>             if emet_form.is_valid() and des_form.is_valid() and 
> fich_form.is_valid(): 
>                     civilite = emet_form.cleaned_data.get('civilite')
>                     nom = emet_form.cleaned_data.get('nom')
>                     prenom = emet_form.cleaned_data.get('prenom')        
>         
>                     cni = emet_form.cleaned_data.get('cni')
>                     mail = emet_form.cleaned_data.get('mail')
>                     telephone = emet_form.cleaned_data.get('telephone')    
>                     pays = emet_form.cleaned_data.get('pays')
>                     ville = emet_form.cleaned_data.get('ville')
>                     quartier = emet_form.cleaned_data.get('quartier')
>                     emet = emet_form.save()
>                     nom = des_form.cleaned_data.get('nom')
>                     prenom = des_form.cleaned_data.get('prenom')
>                     mail = des_form.cleaned_data.get('mail')  
>                     telephone = des_form.cleaned_data.get('telephone')
>                     des = des_form.save()
>                     description_fichier = 
> fich_form.cleaned_data.get('description_fichier')
>                     date_enregistrement = 
> fich_form.cleaned_data.get('date_enregistrement')
>                     observation = fich_form.cleaned_data.get('observation')
>                     montant_prestation = 
> fich_form.cleaned_data.get('montant_prestation')    
>                     fich = fich_form.save()
>         else:
>             emet_form = EmetteurForm()
>             des_form = DestinataireForm()
>             fich_form = FichierForm() 
>                     
>     return 
> render(request,'formulaire/information.html',locals())            
> //***please look ..if my view is good***//
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c82b1ba4-b459-4dba-9313-42115bf84c02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to