Opened 8 years ago

Closed 8 years ago

#4984 closed (wontfix)

Want support for conditional links in templates

Reported by: daniel@… Owned by: adrian
Component: Template system Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

First off -- thanks for Django, it's spectacularly awesome.

One small thing that would improve my life greatly:
Right now, I have a linkbar generated with '<a href="{% url one %}">one</a> <a href="{% url two %}">two</a> <a href="{% url three %}">three</a>', etc. However, I would like this to not generate links to the current page: i.e., if I'm already on two, I want one and three to be links, and two to just be plain text. A filter like '{% cond_url_link some.app.here one %}', maybe with an optional style class or so, that generates the entire link struct for me: <a href="/url/here/">desc</a> if it's a different page, but just the description if we're already on that same page.

Thanks again!

Change History (1)

comment:1 Changed 8 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

Have you tried a custom template tag, specifically an inclusion tag?

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