bornhack-website/camps/managers.py

11 lines
281 B
Python
Raw Normal View History

2016-05-06 20:33:59 +00:00
from django.utils import timezone
from django.db.models import QuerySet
class CampQuerySet(QuerySet):
def current(self):
now = timezone.now()
if self.filter(start__year=now.year).exists():
return self.get(start__year=now.year)
return None