On Mon, Sep 14, 2009 at 7:10 PM, Patrick J McNerthney
<pmcnerth...@clearpointmetrics.com> wrote:
> The objective is not to completely separate the two.  URLs are roughly
> the "Controller" in the MVC world, and need to know about both the
> models and the views.  It is the "glue" that binds the two together.
> URLs already do know about models and that will remain.

Except I can't help thinking this is an awfully arbitrary distinction
to draw. In effect you're saying that nearly every question about an
object should be answerable by interrogating it directly, *except* for
"what's a URL I can use for you?"

That's such a common question that I really think it needs to have an
answer which doesn't involve hunting over multiple layers of the
stack.

> It is having models know about what URLs that is a circular dependency
> that is both unneeded and problematic.  Models should stand alone and be
> usable by any number of applications within the same project.  Having
> the models be responsible for knowing how they are being presented does
> not allow for unanticipated uses of those models.

Keep in mind that the recommended practice is for get_absolute_url()
to work with reverse() and friends, rather than hard-code information
directly. Having it supply a pattern name and some arguments offers
quite a lot of flexibility with no need to monkeypatch anything, and
is why I've consistently harped on this technique in various talks on
effective reuse of Django applications.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~---------~--~----~------------~-------~--~----~
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 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to