Re: What's the best way to do validation?

48 views
Skip to first unread message

Nick Doyle

unread,
Feb 27, 2013, 11:16:00 PM2/27/13
to django-...@googlegroups.com
I'm using FormValidation with good results:
http://django-tastypie.readthedocs.org/en/latest/validation.html

On Monday, 11 February 2013 06:21:43 UTC+11, kai.k...@gmail.com wrote:
Hi!
I have developed an API and want to add validation.
What would be the best way to do this? For now, I did
override my models' save method to call full_clean().
The problem with that is that, if the model does not validate,
I get a list of error messages, but that list doesn't include the
fields the errors belong to. I thought about taking validation
from the model layer and bringing it only to the api because
the whole application is basically the api so I don't need validation
on the model layer. I created Resources that each include several
models, basically aggregating them to provide convenient access.
For that I'm using the full=True attribute to include the children into
their respective parent Resources. Is this a problem if I want to
use FormValidation? Would I have to mangle with the bundles (like
extracting the child Resources before validation) in order for it to work?

How do you guys do validation in combination with "full=True"?

Thanks!

Reply all
Reply to author
Forward
0 new messages