Opened 9 years ago

Closed 8 years ago

#7021 closed (worksforme)

url templatetag not working when used with two words (invalid?)

Reported by: manta@… Owned by: nobody
Component: Template system Version: master
Severity: Keywords: slug model url template
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by Marc Fargas)

When i enter "Two Words" in admin and get them converted to a slug, they're converted to "two-words".

However, when i enter {% url page "two-words" %} in my template to get a permalink to that page, link is not generated at all. If i change "-" to "_" by hand, everything works just fine.

(Removing the milestone until the bug is confirmed)

Change History (3)

comment:1 Changed 8 years ago by Marc Garcia

Component: django-admin.pyTemplate system
milestone: 1.0
Summary: slug bugurl templatetag not working when used with two words (invalid?)

Actually I think that the problem here is a misunderstanding of url templatetag usage, that as far as I know is used for converting views to urls, not pages and slugs.

Check http://www.djangoproject.com/documentation/templates/#url and close as invalid if you think that this is not a correct bug report.

comment:2 in reply to:  description Changed 8 years ago by Marc Fargas

Description: modified (diff)
milestone: 1.0

Replying to manta@idev.lt:

However, when i enter {% url page "two-words" %} in my template to get a permalink to that page, link is not generated at all. If i change "-" to "_" by hand, everything works just fine.

Uhm, could you post the urls.py line that the url should resolve to? It's possible that your regex is not perfect and does not match "-" as a valid character.

comment:3 Changed 8 years ago by Marc Fargas

Resolution: worksforme
Status: newclosed

Closing now as we do not have enough information. Reopen providing more info if it's really a bug. If it's an error from you side please ask on django-users. Thanks.

Note: See TracTickets for help on using tickets.
Back to Top