I am using the FullCalendar plugin for JQuery.
This plugin passes a unix timestamp to a url (both start and end times), which is then used to query the event objects in the database and pull out events which fall within the range of start-end.
However, I keep getting a validation error because the times in my database are stored as datetimes and the value I am comparing them to is a UNIX timestamp.
How can I compare these two dates when running a query?
def fetch_events(request):
start = request.GET.get('start')
end = request.GET.get('end')
e = Event.objects.filter(start__gte=start, end__lte=end).values('id','title','start','end')
data = simplejson.dumps(list(e), cls=DjangoJSONEncoder)
return HttpResponse(data)