title: How to filter gte,lte date on datetime field?
body: <p>I'm trying to figure out how to filter QuerySet using date extracted from datetime. </p>
  
  <p>I use <code>Django-filter</code> and I can't compose such lookup without iterating over QuerySet which is very uneffective.</p>
  
  <p>I tried <code>datetime__date__gte</code> which doesn't work.</p>
  
  <pre><code>class MyReservationsFilter(FilterSet):
      datetime__lte = DateFilter(method='datetime_filter',name='lte')
      class Meta:
          model = Reservation
          fields = {'status': ['exact'],
                    # 'datetime': ['lte', 'gte'],
                    'destination_from': ['exact'],
                    'destination_to': ['exact'],}
  
  
      def datetime_filter(self, queryset, name, value):
  
          lookup = 'datetime__'+name
          return queryset.filter(**{lookup:value})
  </code></pre>
  
  <p>Do you know what to do?</p>
  
  <p>I can't use <code>datetime__lte/gte</code> because:</p>
  
  <p>I have a <code>Reservation</code> object r.</p>
  
  <pre><code>&gt;&gt; r.datetime
  &gt;&gt; datetime.datetime(2017, 8, 31, 17, 55)
  &gt;&gt; r.datetime.date()
  &gt;&gt; datetime.date(2017, 8, 31)
  </code></pre>
  
  <p>So now I try to filter based on date:</p>
  
  <pre><code>Reservation.objects.filter(datetime__lte=datetime.date(2017, 8, 31),datetime__gte=datetime.date(2017, 8, 31))
  
  &gt;&gt; []
  </code></pre>
  
  <p>It's because it doesn't look only on date but on time too. So I need to extract date to be able to filter properly.</p>