Custom model field validation with `clean_fields()`

2010-05-26 Thread kRON
I've recently read about `clean_fields()` and decided to move some stuff to I that I was doing in my `pre_save` handler previously. My tests failed and then I noticed that neither `clean_fields()` nor `full_clean()` was ever called before saving the model. The documentation says that only

Re: custom model field validation

2008-02-08 Thread Jonas Pfeil
> So If I create a newforms field then how do I tell the admin to use > that when building the form in the admin? You will need to use the newforms-admin branch to get the admin to use a newforms field ;) Btw: If you just want the regex functionality you can use the RegexField of newforms like

Re: custom model field validation

2008-02-08 Thread Pigletto
> So If I create a newforms field then how do I tell the admin to use > that when building the form in the admin? If you need this in admin then possibly you have to define your own newforms field with validation. It may be called: myfields.MyField Then you define descednant of CharField from

Re: custom model field validation

2008-02-07 Thread Mackenzie Kearl
On Feb 7, 2:53 am, Pigletto <[EMAIL PROTECTED]> wrote: > On 7 Lut, 09:58, Mackenzie Kearl <[EMAIL PROTECTED]> > wrote:> I am having trouble finding documentation on how to add custom > > validation to a custom model field. > > > example: > > > class PostalField(models.CharField): > > def

Re: custom model field validation

2008-02-07 Thread Pigletto
On 7 Lut, 09:58, Mackenzie Kearl <[EMAIL PROTECTED]> wrote: > I am having trouble finding documentation on how to add custom > validation to a custom model field. > > example: > > class PostalField(models.CharField): > def __init__(self,*args,**kwargs): >

custom model field validation

2008-02-07 Thread Mackenzie Kearl
I am having trouble finding documentation on how to add custom validation to a custom model field. example: class PostalField(models.CharField): def __init__(self,*args,**kwargs): kwargs['max_length']= 6 super(PostalField, self).__init__(*args, **kwargs)