Django url template template and variable values ​​with dot (.)

why {% url myVar%} where myVar = 'jack.johnson' doesn't work?

View ok, urls.py: url (r '^ (? P [A-Za-z0-9 -._] +) / $', overview, name = 'user_profile'),

+1


a source to share


3 answers


Guys, sorry. I found my mistake and the example I gave is misleading. Thanks for the quick response.
+1


a source


Because the url name is "user_profile" and not "jack.johnson".



+1


a source


Please confirm that you are using at least Django 1.0 (named url patterns did not exist before this time), re-read the Django doc on URL Naming Patterns , then try

{% url user_profile myVar %}

      

+1


a source







All Articles