http://docs.djangoproject.com/en/1.2/ref/forms/fields/#required
usu = forms.CharField(required=False, ...)
On Jul 15, 2010, at 5:25 PM, refreegrata wrote:
> Hello list. I'm a newie in django with many questions. I want to do
> something like this:
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> def aaaa(valor):
> raise ValidationError("AAAAA")
>
> class Mmmmm(forms.Form):
> usu =
> forms.CharField(widget=forms.TextInput(attrs={'id':'txtUsu','maxlength':
> '15','size':'20'}),
> validators=[aaaa])
> ------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> The code create a form with an input text. My question is. When i do a
> submit with the field in blank django show an error_ "This field is
> required." and when i write some string in te field django throw an
> error "AAAAA". I only want the error message "AAAAA", and replace the
> default validator with my custom validator. how i do that? the only
> way is do a new field type with a herence from CharField?
>
> That's my question, thanks for read, and sorry my poor english
>
> --
> 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.
>
--
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.