Permalink
Browse files

Adding some simple but useful template context processors.

  • Loading branch information...
1 parent c9e15ca commit 04912c422258ef3189b2fe48dc0249e4647f29e2 @nathanborror committed Aug 20, 2010
Showing with 18 additions and 0 deletions.
  1. +18 −0 basic/tools/context_processors.py
@@ -0,0 +1,18 @@
+from datetime import datetime
+
+from django.conf import settings
+from django.contrib.sites.models import Site
+
+
+def site(request):
+ """
+ Adds the current site to the context.
+ """
+ return {'site': Site.objects.get(id=settings.SITE_ID)}
+
+
+def now(request):
+ """
+ Add current datetime to template context.
+ """
+ return {'now': datetime.now()}

0 comments on commit 04912c4

Please sign in to comment.