djangosnippets.org: Latest snippets tagged with 'current'https://djangosnippets.org/tags/current/2011-11-30T13:29:47.042092-06:00Active link
2011-11-30T13:29:47.042092-06:00ronniehttps://djangosnippets.org/snippets/2617/<p>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:</p>
<p>Usage:
<a href="{% url 'view-name' %}"></a></p>
<ul>
<li>http://gnuvince.wordpress.com/2008/03/19/the-new-and-improved-active-tag/</li>
<li>http://stackoverflow.com/questions/340888/navigation-in-django</li>
</ul>
Freely redistributableDefault to current/all sites in admin (updated!)
2008-10-12T04:43:14.116929-05:00dokterbobhttps://djangosnippets.org/snippets/1128/<p>This code sets the default sites for a sites ManyToMany property to <code>Site.objects.all()</code>, which makes sure you don't have to bother setting it for each item on a site.</p>
<p>This could easily be changed to <code>Site.objects.get_current()</code> to use the current site as default.</p>
Freely redistributable