Subclass EmailMultiAlternatives to add CC: option
This class adds a cc: argument to EmailMultiAlternatives.
- cc
This class adds a cc: argument to EmailMultiAlternatives.
This tag appends the current git revision as a GET parameter to a media files so the web server can set an expires header far in the future. Your project must be structured such that MEDIA_ROOT/../.git exists. Usage: `<link rel="stylesheet" type="text/css" href="{% media myapp/css/base.css %}">`
This middleware implements a "soft timeout". This means the admin is sent an email whenever a page time exceeds a certian value. It is intended to run on production servers to inform the admin of any pages which are performing slowly.
This class runs a django test server in another thread. This is very useful for e.g. selenium integration. Simple to integrate into django test framework. Usage: server = TestServerThread("127.0.0.1", "8081") server.start() # Run tests e.g. req = urllib.urlopen("http://127.0.0.1:8081") contents = req.read() server.stop() ps. I don't actually double space my code :). Not sure whats up with that!
This script generates an [GraphViz](http://www.graphviz.org/) graph of your database structure from your django models. See the usage if the file underneath the license.
Use of a lambda function in the urlpatterns to easily redirect a url.
This is a quick shortcut to redirect the user to a view. The main gain is avoiding having to type 'from django.core.urlresolvers import reverse' every time you want to do a redirect!
This view serves static media and directory indexes for a django application. It should only be used in development, media should be provided directly by a web server in production. This view assumes a django application stores its media in app/media (which is very common) and the file is referred to in the templates by the last part of a django app path. e.g. As in django.contrib.admin -> 'admin'. First we check if the media is a request in an application directory; if so we attempt to serve it from there. Then we attempt to provide the document from the document_root parameter (if provided). To use this view you should add something like the following to urls.py: ` if settings.DEBUG: urlpatterns += (r'^media/(?P<path>.*)$', 'site.media.serve_apps', {'document_root' : settings.MEDIA_ROOT}) ` You can then have the admin media files served by setting ADMIN_MEDIA_PREFIX = '/media/admin/'
This view will serve media files from all media subdirectories of apps in your INSTALLED_APPS setting. Save the view as media.py in your django site folder and add to urls.py: if settings.DEBUG: urlpatterns += patterns('', (r'^media/(?P<appname>\w+)/(?P<path>.+)$', 'devel_site.media.serve_apps') )` Now suppose your installed apps setting looks like: INSTALLED_APPS = ('org.myself.myapp', ...) Then a request to http://localhost/media/myapp/directory/file.css will serve the file org/myself/myapp/media/directory/file.css.
adamlofts has posted 9 snippets.