Login

Tag "current"

Snippet List

Active link

I needed a way to find if a menu items should be active. After searching the internet i found a few options*, but none of them did fit my needs, so i wrote my own: Usage: <a href="{% url 'view-name' %}" class="{% current request 'view-name' %}"></a> * http://gnuvince.wordpress.com/2008/03/19/the-new-and-improved-active-tag/ * http://stackoverflow.com/questions/340888/navigation-in-django

  • template
  • path
  • active
  • link
  • current
Read More

Default to current/all sites in admin (updated!)

This code sets the default sites for a sites ManyToMany property to `Site.objects.all()`, which makes sure you don't have to bother setting it for each item on a site. This could easily be changed to `Site.objects.get_current()` to use the current site as default.

  • admin
  • sites
  • default
  • site
  • current
  • all
Read More

2 snippets posted so far.