Thanks for the fast response Doug,
but those min max constraints are so common? why not include it?
james
On Jul 27, 1:20 pm, Doug B <[EMAIL PROTECTED]> wrote:
> Garg, hit enter too fast.
>
> Class MyForm(forms.Form):
> username = forms.CharField(max_length=12)
> def clean_username(self):
> username = self.clean_data['username']
> if username == 'bob':
> raise ValidationError("Bob is not allowed here")
> return username
>
> If someone enters 'bob' for a username, form.is_valid() will be False,
> anything else under 12 char long is ok
>
> There are existing fields that do a lot, for email, integers, and so
> on... but if you want do do something they don't support, you've got
> to do a bit yourself.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---