diff contests/models.py @ 788:84aa49497718

Added a current contests template tag & installed in sidebar.
author Brian Neal <bgneal@gmail.com>
date Sun, 18 May 2014 17:43:37 -0500
parents 3e1905e523be
children 5977b43499f7
line wrap: on
line diff
--- a/contests/models.py	Sat May 17 12:17:14 2014 -0500
+++ b/contests/models.py	Sun May 18 17:43:37 2014 -0500
@@ -17,6 +17,10 @@
     def get_queryset(self):
         return super(PublicContestManager, self).get_queryset().filter(is_public=True)
 
+    def get_current_contests(self):
+        now = datetime.datetime.now()
+        return self.filter(creation_date__lte=now, win_date__isnull=True)
+
 
 class Contest(models.Model):
     """