Re: Model Custom Validator between more than one field

2010-08-18 Thread skyjur
No because validator validates a single value and should be universal for any use. You should put your logic in model`s validation not field`s. Or you could use a dirty hack which I do not recommend however I've used it by myself: def field1 = models.IntegerField(validators=[validator1])

Re: Model Custom Validator between more than one field

2010-08-18 Thread Renne Rocha
Thank you! It helped me. I must define the Model.clean() method.   Renne Rocha   renne.ro...@gmail.com   http://rennerocha.webfactional.com/ On Wed, Aug 18, 2010 at 9:11 AM, Kenneth Gonsalves wrote: > On Wed, 2010-08-18 at 09:02 -0300, Renne Rocha wrote: >> Is it possible to do this? Or the

Re: Model Custom Validator between more than one field

2010-08-18 Thread Kenneth Gonsalves
On Wed, 2010-08-18 at 09:02 -0300, Renne Rocha wrote: > Is it possible to do this? Or the only way to validate the > relationship between two fields is with form validation? > > this may help: http://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddo#id1 -- regards Kenneth Gonsalves

Model Custom Validator between more than one field

2010-08-18 Thread Renne Rocha
Hello all, I have created custom validators to my models fields, but I don't know if it is possible to create a validator for a field that use the value of other field in its validator. What I am trying to do: I have this model: class MyModel(models.Model): field1 = models.IntegerF