On Wed, 2007-10-24 at 04:40 +0000, Camo wrote:
> Hi Guys,
> 
> I just been working my way through Django, top framework by the way.
> 
> Anyways I just wondering if any one can shed some light model
> validation,
> 
> It seems the only validations are either through the newforms or
> simple validation through the fields.  But there doesn't seem to be
> any bussiness rule validation functions for models.  My concern is
> that validations should really be kept in the model and not in
> forms.
> 
> So I was just wondering how people go about validating models.

At the moment this is work in progress. There is some development going
on to finish up model-aware validation and complete some earlier work on
model validation. At that time, you'll be able to call
my_model.validate() and have things work similarly to how they do with
newforms.

Right now, there's a validate() method on the Model class, but it is
incomplete and not recommended for production use.

In the interim, doing things in the save() method is possible, although
it's not a brilliantly nice design, since save() should never raise
validation errors and, if it does, you won't get feedback to, say, the
admin interface or places like that. But it's the workaround you need to
do at the moment.

Regards,
Malcolm

-- 
Atheism is a non-prophet organization. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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