El Fri, 18 Sep 2009 05:07:51 -0700 (PDT)
dijxtra <nsko...@gmail.com> escribió:

> I'm sure I'll be hitting my head against the wall when I hear the
> answer, but before I do, I just can't get an idea how to solve this
> although it seems to me that the solution must be trivial. So, here is
> a line from my url patterns:
> 
> url(r'^(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/$', 'day',
> name='day'),
> 
> and here is what I want to put in my template:
> 
> {% url day year={% now "Y"%} month={% now "m"%} day={% now "d"%} %}
> 
> but, ofcourse, I won't put that in my template because you can't have
> tag inside of a tag. Soo, dear ladies and gentelmen, what's the
> obvious solution I'm to blind to see?

You have to have the data available in the context, templatetags only accept
context values as parameters. So I'm guessing the obvious way to do it is
handing what datetime.datetime.now() returns (you'll probably need to convert
it to a string) to the template context from your view.

You could also write a "datetime" context processor to hand current datetime
data to all your templates.

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/

Attachment: pgpeYovwlP0TK.pgp
Description: PGP signature

Reply via email to