Django - How to filter by date with Django Rest Framework? : <p>I have some model with a timestamp field:</p>

<p>models.py</p>

<pre><code>class Event(models.Model):
    event_type = models.CharField(
        max_length=100,
        choices=EVENT_TYPE_CHOICES,
        verbose_name=_("Event Type")
    )
    event_model = models.CharField(
        max_length=100,
        choices=EVENT_MODEL_CHOICES,
        verbose_name=_("Event Model")
    )
    timestamp = models.DateTimeField(auto_now=True, verbose_name=_("Timestamp"))
</code></pre>

<p>I'm then using Django-rest-framework to create an API endpoint for this class, with django-filter providing a filtering functionality as follows:</p>

<pre><code>from .models import Event
from .serializers import EventSerializer
from rest_framework import viewsets, filters
from rest_framework import renderers
from rest_framework_csv import renderers as csv_renderers


class EventsView(viewsets.ReadOnlyModelViewSet):
    """
    A read only view that returns all audit events in JSON or CSV.
    """
    queryset = Event.objects.all()
    renderer_classes = (csv_renderers.CSVRenderer, renderers.JSONRenderer)
    serializer_class = EventSerializer
    filter_backends = (filters.DjangoFilterBackend,)
    filter_fields = ('event_type', 'event_model', 'timestamp')
</code></pre>

<p>with the following settings:</p>

<pre><code>REST_FRAMEWORK = {
    'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',),
}
</code></pre>

<p>I'm able to filter by <code>event_type</code> and <code>event_model</code>, but am having trouble filtering by the timestamp field. Essentially, I want to make an API call that equates to the following:</p>

<pre><code>AuditEvent.objects.filter(timestamp__gte='2016-01-02 00:00+0000')
</code></pre>

<p>which I would expect I could do as follows:</p>

<pre><code>response = self.client.get("/api/v1/events/?timestamp=2016-01-02 00:00+0000", **{'HTTP_ACCEPT': 'application/json'})
</code></pre>

<p>though that is incorect. How do I make an API call that returns all objects with a timestamp greater than or equal to a certain value?</p>
