On Wed, 2007-08-08 at 15:46 +0800, !张沈鹏(电子科大 08年毕业) wrote:
> because if I want to get the link first , then get the count number .
> if I just use reverse() in my custom tag, I have to write like below
> 
> <a href="{% url music "rock",112 %}">xxx</a>
> Digg:{% access_count_url music "rock",112 %}
> 
> I write the same things twice , and if I want write a link such as
> "add to shopping list" I have to write the same thing
> <a onclick="add({% url music "rock",112 %})" >Add  to shopping list</a>
> 
> I find the url always use more than once , so I suggest if can use like this
> {% url music "rock","112" as music_url %}
> maybe more convenience

A general design observation, rather than making a specialised
modification to just one tag like this -- which leads to requests to
modify other tags similarly and it never ends -- it's probably better to
try to work out a general extension to the "with" tag for aliases like
this. Recall that the "with" tag is designed to cache variable lookups
at the moment. Caching template tag results might not be a terrible
extension.

I'm not sure what the syntax would look like at the moment, but it's
something I need to think about: it would help solve one or two i18n
rough spots, too. This is teetering on the edge of "variables in
templates", but aliasing is pretty common even in functional languages
as a typing saver type of sugar.

I'm not sure if there's a hidden gotcha here, but I would rather
investigate in that direction than adding aliasing hooks to tags as
people decide they might want them.

Regards,
Malcolm

-- 
On the other hand, you have different fingers. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to