Opened 7 years ago

Closed 7 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 telenieko)

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 7 years ago by garcia_marc

  • Component changed from django-admin.py to Template system
  • milestone set to 1.0
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from slug bug to url 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 7 years ago by telenieko

  • Description modified (diff)
  • milestone 1.0 deleted

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 7 years ago by telenieko

  • Resolution set to worksforme
  • Status changed from new to closed

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