On 3/14/06, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > This is based on a simplistic assumption that everytime we are talking about > validation in django context we are talking about model based validation.
No, it's based on an assumption that the facilities for doing custom validation that currently exist in manipulators could be relocated. > 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. Setting aside your premise about the most common thing in web apps (which is actually retrieving data from a DB and displaying it), I don't see that your conclusion follows; could you please demonstrate why it would be impossible to allow custom validation code to be placed in a model? > 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? Why would validation in a model be dependent on a request? If anything, Adrian's proposal makes Django *more* flexible because it removes the hard-wired assumption in the manipulator system that the data is coming from an HTML form; under Adrian's proposal, the model doesn't care where the data's coming from -- you just build it up and try to call save(), and if there are errors it tells you about them. > 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? Again, please demonstrate to me why you feel it's impossible for custom validation to be done in models. And if, as you feel, it's impossible for the model layer to provide adequate flexibility for validation, then I don't see how any other layer of the framework could do so in its place. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
