I am Using Django Rest Frame Work and I Want to build filter time by date and id
urls.py
path('health-heartrate/',healthHeartRate,name='health-heart-rate')
Time Field in Database : 2016-03-29 00:00:05.000000
views.py
@api_view(['GET'])
def healthHeartRate(request):
if request.method=='GET':
strDate=request.query_params.get('strDate',None)
strDate=datetime.datetime.strptime(strDate, "%Y-%m-%d").date()
endDate=strDate + datetime.timedelta(days=1)
filter_date=Health.objects.filter(pk=id).filter(time_gte=strtDate).filter(time_lte=endDate)
serializer=HealthFilterSerializer(filter_date,many=True)
return Response(serializer.data)
Url > http://127.0.0.1:8000/api/v1/health-heartrate/?id=1&strDate=2016-03-28
I got the Following Error in Browser
TypeError at /api/v1/health-heartrate/
int() argument must be a string, a bytes-like object or a number, not 'builtin_function_or_method'