djangosnippets.org: Latest snippets posted by Magushttp://djangosnippets.org/users/Magus/2008-03-13T02:28:15.325991-05:00Maguslocal_settings override for project settings
2008-03-13T02:28:15.325991-05:00Magushttp://djangosnippets.org/snippets/644/<p>Place this snippet at the bottom of your settings.py file, and if a local_settings.py file is present in the directory, all settings in that file will override those in settings.py</p>
Freely redistributableLogging Middleware
2007-09-28T18:48:39.625007-05:00Magushttp://djangosnippets.org/snippets/428/<p>This is a simple Logging Middleware that uses the python logging functions.</p>
<p>Simply drop this snippet in a file in your project such as <code>logmw.py</code> (don't try to call it <code>logging.py</code> though), then add the class to MIDDLEWARE_CLASSES in your settings file. (for instance, <code>'mysite.logmw.LoggingMiddleware'</code>)</p>
<p>Updated 8/25/08: added PhonyLogger …</p>
Freely redistributableAuth decorators with 403
2007-05-25T14:58:37.148176-05:00Magushttp://djangosnippets.org/snippets/254/<p>These decorators are based on user_passes_test and permission_required, but when a user is logged in and fails the test, it will render a 403 error instead of redirecting to login - only anonymous users will be asked to login.</p>
Freely redistributablerender_to_response wrapper
2007-02-25T13:43:10.817721-06:00Magushttp://djangosnippets.org/snippets/3/<p>Simplifies using RequestContext in render_to_response.</p>
<p>Simply call the wrapper with request as the first argument, and the rest of the arguments are as normal for render_to_response.</p>
<p>ex: render_response(request, 'foo_list.html', {'foo': Foo.objects.all()})</p>
Freely redistributable