Hi,
The following code does not work:
....
tipo_de_visa = cleaned_data.get("formamig")
.....
if tipo_de_visa and tipo_de_visa == 'NEGOCIO':
....
thanks.
On 15 sep, 16:03, Daniel Roseman <[email protected]> wrote:
> On Sep 15, 9:48 pm, alivad <[email protected]> wrote:
>
>
>
> > hi all:
>
> > I have the following code:
>
> > .....
> > formamig = forms.ModelChoiceField(label = "Tipo de visa",
> > queryset=Formamig.objects.all())
> > empresa = forms.CharField(max_length=60, required=False)
>
> > def clean(self):
> > cleaned_data = self.cleaned_data
> > tipo_de_visa = cleaned_data.get("formamig")
> > empresa = cleaned_data.get("empresa")
>
> > #if tipo_de_visa and "NEGOCIO" in tipo_de_visa:
> > if tipo_de_visa and tipo_de_visa == 'NEGOCIO':
> > #raise forms.ValidationError("Debe ingresar el nombre de
> > la empresa.")
> > msg = u"Debe ingresar el nombre de la empresa."
> > self._errors["tipo_de_visa"] = ErrorList([msg])
> > self._errors["empresa"] = ErrorList([msg])
>
> > # These fields are no longer valid. Remove them from the
> > # cleaned data.
> > del cleaned_data["tipo_de_visa"]
> > del cleaned_data["empresa"]
>
> > return cleaned_data
>
> > with the above code I am trying to validate if the user selects
> > business then you must place the name of the company.
>
> > It does not work, someone can help me.
>
> > Thanks
>
> What does not work? What happens?
> --
> DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---