Re: Possible error at usage of reverse URL in templates.

2014-06-22 Thread Russell Keith-Magee
Hi Sebastian, There is a very significant difference between the third pattern and the last - the extra set of braces. That extra set of braces means that the regex group that is being matched is (?P\d+)/ That is - one or more numerical digits, identified as playerId, that *must* be followed by

Possible error at usage of reverse URL in templates.

2014-06-21 Thread Sebastian Piskorski
I'd like to make sure that this is an error not the feature. I use following code in template {{ player.id }} : "{{ player.name}}" And in urls.py everything goes fine with those rules: 1. url(r'^player/select/(?P\d+)/$', myapp.views.player.select, name="player-select"), result URL is: /player

Re: Problems with {% url %} in templates

2012-03-29 Thread Jamie Lawrence
On Mar 29, 2012, at 12:59 PM, Alasdair Nicol wrote: > Hi Jamie, > Don't include the (.*)$ in the regex for the include. The documented pattern > [1] for the include is > >(r'^d/events/', include('myproject.events.urls')), Ah, thank you, that was it. (I do need sleep - don't know how long

Re: Problems with {% url %} in templates

2012-03-29 Thread Alasdair Nicol
Hi Jamie, On 29/03/12 20:49, Jamie Lawrence wrote: I'm very confused… this has worked fine in the past. Django 1.3.1 In myproject/urls.py: urlpatterns = patterns('', (r'^d/events/(.*)$', include('myproject.events.urls')), […] Don't include the (.*)$ in the regex for the include. The docum

Problems with {% url %} in templates

2012-03-29 Thread Jamie Lawrence
I'm very confused… this has worked fine in the past. Django 1.3.1 In myproject/urls.py: urlpatterns = patterns('', (r'^d/events/(.*)$', include('myproject.events.urls')), […] in myproject/events/urls.py : urlpatterns = patterns('myproject.events.views', url(r'^add/$', 'add_view', nam

Re: {% url in templates

2009-10-29 Thread Umapathy S
On Thu, Oct 29, 2009 at 1:40 PM, Alex Robbins wrote: > > Maybe it is just me, but I feel like writing out the view functions > like that is a beating. I just name[1] all the urls. Then the url tag > is easy. I just do things like {% url home-page %} or {% url blog- > index %}. If you set up a gen

Re: {% url in templates

2009-10-29 Thread bruno desthuilliers
On 29 oct, 14:40, Alex Robbins wrote: > Maybe it is just me, but I feel like writing out the view functions > like that is a beating. It's not just you !-) yeps, named urls are the RightThing(tm) to do. --~--~-~--~~~---~--~~ You received this message because you

Re: {% url in templates

2009-10-29 Thread Alex Robbins
Maybe it is just me, but I feel like writing out the view functions like that is a beating. I just name[1] all the urls. Then the url tag is easy. I just do things like {% url home-page %} or {% url blog- index %}. If you set up a generic view in the views and name it, it will work like normal. [

Re: {% url in templates

2009-10-28 Thread Umapathy S
On Wed, Oct 28, 2009 at 8:03 PM, Gabriel . wrote: > > On Wed, Oct 28, 2009 at 4:16 PM, Umapathy S wrote: > > view_xyz is the view function. No arguments. > > > > exps is the application. pams is project. > > > > pams/urls.py > > > > urlpatterns = patterns('', > > # Example: > > # (r'^p

Re: {% url in templates

2009-10-28 Thread Gabriel .
On Wed, Oct 28, 2009 at 4:16 PM, Umapathy S wrote: > view_xyz is the view function.  No arguments. > > exps is the application.  pams is project. > > pams/urls.py > > urlpatterns = patterns('', >     # Example: >     # (r'^pams/', include('pams.foo.urls')), >     (r'pams/', include('pams.exps.url

Re: {% url in templates

2009-10-28 Thread Umapathy S
view_xyz is the view function. No arguments. exps is the application. pams is project. pams/urls.py urlpatterns = patterns('', # Example: # (r'^pams/', include('pams.foo.urls')), (r'pams/', include('pams.exps.urls')), pams/exps.urls.py from django.conf.urls.defaults import * fro

Re: {% url in templates

2009-10-28 Thread Gabriel .
On Wed, Oct 28, 2009 at 3:55 PM, Umapathy S wrote: > > Hello there, > > I am developing a page which has a left side menu.  This menu is a seperate > html and gets includes in the base.html template. > > To make it less vulnerable to url changes, I am trying to implement the {% > url %} > > in

Re: {% url in templates

2009-10-28 Thread David Zhou
What's your 'view_xyz'? Are you sure that view_xyz is accessible through an URL without any arguments? -- dz On Wed, Oct 28, 2009 at 2:55 PM, Umapathy S wrote: > Hello there, > > I am developing a page which has a left side menu. This menu is a seperate > html and gets includes in the base.h

{% url in templates

2009-10-28 Thread Umapathy S
Hello there, I am developing a page which has a left side menu. This menu is a seperate html and gets includes in the base.html template. To make it less vulnerable to url changes, I am trying to implement the {% url %} in lhsmenu.html view {% url exps.view_xyz as viewxyzurl