Hi,

The right way(TM) to do this is using named urls:

http://docs.djangoproject.com/en/dev/topics/http/urls/#named-groups

Then you can use reverse to get the right url, avoiding duplications and
problems like the one you have now:

http://docs.djangoproject.com/en/dev/topics/http/urls/#django.core.urlresolvers.reverse

HTH,


On Tue, Sep 15, 2009 at 4:42 PM, dijxtra <[email protected]> wrote:

>
> Hello everybody,
>
> Django keeps surprising me with neat solutions for common web
> programming problems (I must say I haven't felt this "where has it
> been all of my life" since the time I was exploring lisp), so I hope
> django has a trick up his sleeve for this one too.
>
> So, I made a calendar "widget" (view snippet:
> http://pastebin.com/m765f778c,
> template snippet: http://pastebin.com/m16dcf115) and I have a problem
> with relative links in it. If I include this code in page with URL url/
> prefix/yyyy/mm/dd (which represents one day), then my links point to
> right places, but if I'm in url/prefix/yyyy/mm (which represents the
> whole month) then links point to the wrong place because they are
> relative links, and they were made to work with /yyyy/mm/dd, not /yyyy/
> mm.
>
> I tried to fix it with my {{calendar_data.path}} variable, but that's
> one ugly solution. I suppose this is a common problem... so, I suppose
> there is a common solution?
>
> BTW, if you give me constructive advice about my coding style, you get
> bonus points for heaven and I love you till the end of my life. :-D
>
> Thanks in advance,
> nick
>
> >
>


-- 
Tiago Serafim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to