Well, as i said, overriding save() does not provide the ability to
raise an error which is field-specific.

What i want to do, was possible with validator_list. I actually don't
understand why this functionality has been removed.

On Mon, Jul 21, 2008 at 7:59 PM, Jeff FW <[EMAIL PROTECTED]> wrote:
>
> If that's what you want, then override the save() method of the model
> that throws an exception if it doesn't meet your requirements.
>
> -Jeff
>
> On Jul 21, 9:43 am, "Alex Rades" <[EMAIL PROTECTED]> wrote:
>> The point is that i see this validation as tied to the model, not to a
>> specific form. For me this as an integrity check, something which
>> should be done at model level.
>>
>> On Mon, Jul 21, 2008 at 3:20 PM, Jeff FW <[EMAIL PROTECTED]> wrote:
>>
>> > Sounds like you're looking at the oldforms documentation--that's all
>> > been deprecated.  Read this instead:
>> >http://www.djangoproject.com/documentation/newforms/
>>
>> > Especially this part:
>> >http://www.djangoproject.com/documentation/newforms/#custom-form-and-...
>>
>> > -Jeff
>>
>> > On Jul 21, 8:14 am, "Alex Rades" <[EMAIL PROTECTED]> wrote:
>> >> Hi,
>>
>> >> First of all, I'm using trunk :)
>>
>> >> I have a couple of models like:
>>
>> >> class User(model.Model):
>> >>     group = models.ForeignKey(Group)
>>
>> >> Class Group(model.Model):
>> >>     interest = models.ForeignKey(Interests)
>>
>> >> Basically i want to be possible to change in the admin the interest of
>> >> a Group *only if*:
>>
>> >> self.user_set.count() == 0
>>
>> >> The documentation is not very about custom validation, it says to pass
>> >> validator_list to the field definition, so i've tried with:
>>
>> >> interest = models.ForeignKey(interests, validator_list = [ myvalidator ])
>>
>> >> But it seems the custom validators are not called at all. Is this
>> >> possible? How do I perform custom validation on a specific form? Doing
>> >> it into the save() method of the model is not suitable (I want to
>> >> raise an error which is specific to a field and is displayed next to
>> >> the field itself)
>>
>> >> Thanks
> >
>

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