bornhack-website/tickets/managers.py

14 lines
310 B
Python
Raw Normal View History

2016-05-06 20:33:59 +00:00
from psycopg2.extras import DateTimeTZRange
from django.db.models import QuerySet
from django.utils import timezone
class TicketTypeQuerySet(QuerySet):
def available(self):
now = timezone.now()
return self.filter(
available_in__contains=DateTimeTZRange(now, None)
)