Code

Opened 7 years ago

Closed 7 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!

Attachments (0)

Change History (1)

comment:1 Changed 7 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?

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.