On Aug 21, 5:25 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> good stuff

Thanks very much for the good explanation.

> > Third: If one is to reverse map views to URLs, which is the best way
> > to do it (if there is a best way)?
>
> Clarify what you mean by this?

Well, perhaps I was unclear because of my limited understanding.  I
now see why I should always define get_absolute_url() in templates,
and that in templates, when I need a URL, I should write {% url
object.get_absolute_url %} or {% url_pattern_name %} (possibly with
extra arguments), right?  Is there a reason to prefer one of these
forms to the other?  They seem interchangable.

And if I need a URL in a view, e.g., in an HttpResponseRedirect()
constructor, I can use the reverse() function, right?

But I still don't understand the permalink decorator is defined the
way it is, so one has to write
get_absolute_url = permalink(get_absolute_url)
Wouldn't it have been simpler to define permalink as an ordinary
function, and write
return permalink('people.views.details', [str(self.id)])
inside the definition of get_absolute_url()?

(Here, the documentation seems to fail to explain why things are as
they are.  Mostly it does a good job of explaining why as well as
what.)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to