Mercurial > public > sg101
comparison 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 |
comparison
equal
deleted
inserted
replaced
787:7e17b9e45356 | 788:84aa49497718 |
---|---|
14 The manager for all public contests. | 14 The manager for all public contests. |
15 | 15 |
16 """ | 16 """ |
17 def get_queryset(self): | 17 def get_queryset(self): |
18 return super(PublicContestManager, self).get_queryset().filter(is_public=True) | 18 return super(PublicContestManager, self).get_queryset().filter(is_public=True) |
19 | |
20 def get_current_contests(self): | |
21 now = datetime.datetime.now() | |
22 return self.filter(creation_date__lte=now, win_date__isnull=True) | |
19 | 23 |
20 | 24 |
21 class Contest(models.Model): | 25 class Contest(models.Model): |
22 """ | 26 """ |
23 A model to represent contests where users sign up to win something. | 27 A model to represent contests where users sign up to win something. |