thx, that's what I thought but wasn't sure if I was missing something.
I don't really like that you then have..

 maxlength=3, validator_list=...

I guess I could subclass CharField....

On Jun 5, 10:33 am, Tim Chase <[EMAIL PROTECTED]> wrote:
> > seems silly but how do I specify minimum length for a
> > CharField. Would that require customer validation?
>
> I suspect you just want a custom validator in your
> validator_list...something like
>
> def is_longer_than(n):
>    def result(field_data, all_data):
>      if len(field_data) <= n:
>        raise django.core.validators.CriticalValidationError, \
>          'Must be more than %i character(s)' % n
>    return result
>
> class Whatever(Model):
>    myfield = CharField(...
>      validator_list = [is_longer_than(10)],
>      ....
>      )
>
> -tim


--~--~---------~--~----~------------~-------~--~----~
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