Opened 17 years ago

Closed 17 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: dev
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: no UI/UX: no

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 by Marc Garcia, 17 years ago

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.

in reply to:  description comment:2 by Marc Fargas, 17 years ago

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 by Marc Fargas, 17 years ago

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