djangosnippets.org: Latest snippets posted by tclinekshttps://djangosnippets.org/users/tclineks/2008-08-23T16:46:19.240235-05:00tclineksNotifications Middleware for Session-Backed Messages
2008-08-23T16:46:19.240235-05:00tclinekshttps://djangosnippets.org/snippets/1002/<p>simple middleware and context processor for session-based messaging with types
Heavily inspired by patches on ticket 4604. Differs in that in this a notification
has type.</p>
<p>Installation:</p>
<ul>
<li>add notifications.NotificationMiddleware to MIDDLEWARE_CLASSES</li>
<li>and notifications.notifications to TEMPLATE_CONTEXT_PROCESSORS</li>
</ul>
<p>That assumes notifications.py is on pythonpath. If notifications.py lives in
your project dir, prefix those …</p>
Freely redistributablequick_url filter
2008-04-28T23:15:10.173327-05:00tclinekshttps://djangosnippets.org/snippets/730/<p>A simple filter that generates a url from an object that has a get_absolute_url method.</p>
<p>{{ object|quick_url }}</p>
<p>a previous, simpler approach:
<a href="http://www.djangosnippets.org/snippets/511/">#511</a></p>
Freely redistributableSimple View Middleware to allow a Prefilter
2008-04-22T10:09:22.619394-05:00tclinekshttps://djangosnippets.org/snippets/715/<p>This allows you to define a 'prefilter' function in your view modules which will be invoked before any view in that same. This provides an easy place to decorate the request or modify arguments.
</p>
<p>For simplicity it doesn't allow configuration of the name of the prefilter function. I also skipped …</p>
Freely redistributable