Re: Many links to one function in url.py

2014-05-21 Thread Lucas Klassmann
Hi Jun, The diference is: With \w only one character is allowed and not allow null, like this: /link/a/ With \w+ one or more characters is allowed and not allow null, like this: /link/mypage/ With \w* zero or more is allowed and also null argument, like this: /link// (Note the double slash,

Re: Many links to one function in url.py

2014-05-21 Thread François Schiettecatte
You can also do something like this: (r'^link(?Pd+)/$', 'project.apps.main.get'), project.apps.main.get will be passed a parameter called linkID containing the number, and if you wanted to limit it to digits 1 through 4, you would use: (r'^link(?P[1-4])/$',

Re: Many links to one function in url.py

2014-05-21 Thread Tom Evans
On Wed, May 21, 2014 at 3:40 AM, Jun Tanaka wrote: > Hi there. > > > I hope to know the solution for the following: > say, there are several links to one function but I would like to identify > which link that come from. > > url.py looks > > (r'^link1/$',

Re: Many links to one function in url.py

2014-05-21 Thread Jun Tanaka
Hi Lucas, Thank you very much. It seems that I can use this. Hopefully, I can ask you one more question. \d+ is for a int. is \w+ for a string? What does \w* mean? I saw it. Jun 2014年5月21日水曜日 11時49分46秒 UTC+9 Lucas Klassmann: > > Hi Jun, > > Try this: > > Put only this line in urls.py > >

Re: Many links to one function in url.py

2014-05-20 Thread Lucas Klassmann
Hi Jun, Try this: Put only this line in urls.py url(r'^link/(?P<*identifier*>\d+)/$', 'project.apps.main.get'), And in your view, add *identifier* as argument in function: def get(request, *identifier*): ... return HttpResponse(u'Identifier %d' % *identifier*) Note that *identifier*

Many links to one function in url.py

2014-05-20 Thread Jun Tanaka
Hi there. I hope to know the solution for the following: say, there are several links to one function but I would like to identify which link that come from. url.py looks (r'^link1/$', 'project.apps.main.get'), (r'^link2/$', 'project.apps.main.get'), (r'^link3/$',