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, django will allow urls like this)

And \d+ is same that \w+, but for only numbers.

More information, you must read Regular Expression for python:
https://docs.python.org/2/library/re.html

Cheers


On Wed, May 21, 2014 at 1:07 PM, Jun Tanaka <tna...@gmail.com> wrote:

> 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
>>
>> 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* is a *int* and you must use link as */link/1*
>>
>> Read more:
>> https://docs.djangoproject.com/en/dev/topics/http/urls/
>>
>> Cheers.
>>
>> --
>> Lucas Klassmann
>> Software Developer
>> Email: lucaskl...@gmail.com
>> Web site: http://www.lucasklassmann.com
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1fc15ca2-d8a5-4856-b14e-be5eefa9225b%40googlegroups.com<https://groups.google.com/d/msgid/django-users/1fc15ca2-d8a5-4856-b14e-be5eefa9225b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Lucas Klassmann
Desenvolvedor de Software

Email: lucasklassm...@gmail.com
Web site: http://www.lucasklassmann.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOz50pJY2-SRatOiUnzeUHNNpV7cXLnLmCYjwJKbQy6-yWB9BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to