Re: Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
Ok, solved the problem. Thanks Lukasz and thanks to all... from django.core.validators import RegexValidator import re namespace_regex = re.compile(r'^[a-z\-]+$') alias = models.CharField( max_length = 100, unique = True, validators=[RegexValidator(regex=namespace_regex)] ) 2011/2/4 ozgur yilmaz

Re: Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
Maybe RegexValidator can solve this problem. But i couldnt manage to use it: from django.core.validators import RegexValidator alias = models.CharField( max_length = 100, unique = True, validators=[RegexValidator('[a-z]')] ) 2011/2/4 ozgur yilmaz > Yes, i know overriding field cleand method,

Re: Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
Yes, i know overriding field cleand method, but i couldnt get a start point for character match code. 2011/2/4 Shawn Milochik > > On Feb 4, 2011, at 2:47 PM, ozgur yilmaz wrote: > > It was possible in the past with validator_list. Like: > > regex = r'^[A-z][\w-]{2,31}$' > > name = models.CharFie

Re: Charfield, limiting acceptable characters

2011-02-04 Thread Ɓukasz Rekucki
On 4 February 2011 20:47, ozgur yilmaz wrote: > It was possible in the past with validator_list. Like: > > regex = r'^[A-z][\w-]{2,31}$' > > name = models.CharField(max_length=32, unique=True , > validator_list=[validators.MatchesRegularExpression(regex)] ) > It still is? http://docs.djangoprojec

Re: Charfield, limiting acceptable characters

2011-02-04 Thread Shawn Milochik
On Feb 4, 2011, at 2:47 PM, ozgur yilmaz wrote: > It was possible in the past with validator_list. Like: > > regex = r'^[A-z][\w-]{2,31}$' > name = models.CharField(max_length=32, unique=True , > validator_list=[validators.MatchesRegularExpression(regex)] ) > > But with what code to override t

Re: Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
It was possible in the past with validator_list. Like: regex = r'^[A-z][\w-]{2,31}$' name = models.CharField(max_length=32, unique=True , validator_list=[validators.MatchesRegularExpression(regex)] ) But with what code to override the clean method? Is there any sample or built in function for t

Re: Charfield, limiting acceptable characters

2011-02-04 Thread Shawn Milochik
The easiest thing to do is override the clean on your form. Shawn -- 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 django-users+un