On Mar 13, 2006, at 9:41 PM, James Bennett wrote:
> Sure they can. Imagine explaining Django to someone who's never seen
> an MVC model before; if you told them "the model is where you provide
> all the information about a class of objects, and describe how it
> works", they'd be awfully confused if you then said, "oh, except for
> this and this and this, which have to be specified somewhere else."
>
> Better to have all the information about a class of objects, including
> whatever information is needed to validate it, all in one place.
That's a great explanation, James.
To explore it a bit further: I'm often asked why Django doesn't use
SQLObject or some other Pythonic ORM. My standard answer is that
Django's ORM does a lot more than just describe how to map relational
tables to Python objects: it explains how to construct an interface
for editing the object, it describes validation information about an
object's fields that the database often can't encode, and so on.
Given that, I think validation is something that very much SHOULD be
defined and happen on the model. Yes, this runs counter to MVC, but
we've already established that Django isn't exactly MVC anyway. As
I see it:
- Model: describe the data
- View: describe what the user sees
- Template: describe how the user sees it
Remember, kids, we're the MTV generation.
Jacob
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---