* Add "static" context processor that puts STATIC_URL_PREFIX in the context.
[matthijs/projects/xerxes.git] / tools / context_processors.py
diff --git a/tools/context_processors.py b/tools/context_processors.py
new file mode 100644 (file)
index 0000000..b0d0282
--- /dev/null
@@ -0,0 +1,12 @@
+from django.conf import settings
+
+"""
+Some useful context processors.
+"""
+def static(request):
+    """
+    Adds url of static files to the context.
+    Requires STATIC_URL to be set in the settings.
+
+    """
+    return {'STATIC_URL_PREFIX': settings.STATIC_URL_PREFIX}