* It's conceptually simpler; instead of worrying about which
validation layer you got down to before an error occurred, you only
have to worry about two states: success and failure.
* It's more logical; I still don't see any good reason why information
about how to validate an instance of a model shouldn't be part of the
model.
This is based on a simplistic assumption that everytime we are talking about validation in django context we are talking about model based validation. views are handling forms, and we should always add form in front of validation whenever we are talking about validation. Model can have a simplistic type checking like validation, which will raise ValidationError while saving, but trying to fit all/any form validation into model validation is just twisted. Django is a web framework. In web apps, the most common thing to validate is form. We can not ignore these two things.
Bottom line, can you gaurantee all validations can go on model? Will you make model dependent on request, and any other potentially django external check a web developer might have to use in their application? We can not do validation in models, we can try, we can do a little bit, but there is no limit to what application specific requirement can ask. What is the point of making people learn about the model based validation framework when we are going to tell them that not all validation can be done, and you will have to invent your own validation framework?
--
Amit Upadhyay
Blog: http://www.rootshell.be/~upadhyay
+91-9867-359-701
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django developers" 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-developers
-~----------~----~----~----~------~----~------~--~---
