Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django filter queryset by date

# gt - Greater than.
# gte - Greater than or equal to.
# lt - Less than.
# lte - Less than or equal to.

import datetime
samples = Sample.objects.filter(sampledate__gte=datetime.date(2011, 1, 1),
                                sampledate__lte=datetime.date(2011, 1, 31))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #filter #queryset #date
ADD COMMENT
Topic
Name
2+2 =