14 lines
307 B
Python
14 lines
307 B
Python
from psycopg2.extras import DateTimeTZRange
|
|
|
|
from django.db.models import QuerySet
|
|
from django.utils import timezone
|
|
|
|
|
|
class ProductQuerySet(QuerySet):
|
|
|
|
def available(self):
|
|
now = timezone.now()
|
|
return self.filter(
|
|
available_in__contains=DateTimeTZRange(now, None)
|
|
)
|