I have the following query:
query=Detalles.objects.filter(fecha_creacion__range=(fecha_inicio,fecha_final))
The expected result is to filter the results between date A and date B, that is:
fechaA= 01-07-2018 FechaB=04-07-2018
However, the query only returns until 03-07-2018, that is until a day before.
To return until 04-07-2018 it is necessary to pass a date later, that is, put 05-07-2018 to return until 04-07-2018.
Range takes all the values between FechaA
and FechaB
but I do not know if I need to specify something more or how can I improve the query better.
Edited
fecha_inicio = request.GET.get('fechaA')
fecha_final = request.GET.get('fechaB')
time.min
datetime.time(0, 0)
time.max
datetime.time(23, 59, 59, 999999)
fecha_inicio = datetime.combine(fecha_inicio, time.min)
fecha_final = datetime.combine(fecha_final, time.max)