On 3/14/06, James Bennett <[EMAIL PROTECTED]> wrote:
>
> On 3/13/06, limodou <[EMAIL PROTECTED]> wrote:
> > Maybe or maybe not. What django has implemented is exactly as what I
> > said, I think the ways is good. And I remember there was a discussion
> > about js invalidation, why we need this. Because we want to make
> > mistakes can be found early, but not until the data will be saved.
>
> As I see it, the question here is which of two options we want to take:
>
> 1. Validation is performed when you try to save an object; if
> validation fails, you send back some error messages and try again with
> corrected data.
>
> 2. One or more extra layers are placed between data entry and saving
> the object; different layers do different types of validation, and any
> one of them can kick you back out to the data-entry layer.
>
> Option 1 is what we seem to be heading toward with validation-aware
> models, and I think it's good for a couple of reasons:
>
> * 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.
>
> * It's better from an end-user standpoint; to see why, imagine that
> instead we have a system with multiple layers which do validation. In
> this case, an end user creating or editing an object may make a
> mistake in entering the data, and be presented with a set of errors.
> He corrects them and tries again to submit the data, but this time it
> comes back with a different set of errors that have been present all
> along, but were never reported because the data never made it to the
> layer that would have caught them before. This poor user would become,
> understandably, frustrated that he wasn't told about these errors the
> first time he tried to submit the data. When validation is all in the
> same place, this will never be a problem because all errors will be
> caught and reported each time the data is submitted.
>
>

Reasons sound very reasonable. But I think current implement in django
is enough. Maybe model with validation is better but unnecessary. We
have many ways to validate data before it saved in db.

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

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

Reply via email to