Skip to content Skip to sidebar Skip to footer

Filter Range From Two Dates In The Same Query Django/Python

I need the result from a query that filters two dates from the same model. I need to get in the result 5 days (today plus 4 days) from original date and sale from target date (toda

Solution 1:

In your code, don't use bracket with __range.

  startdate = datetime.date().today()
  endate = datetime.date().today() + timedelta(days=4)
  lineas_de_reporte = Reporteots.objects.filter(original_fcd_date__range=(startdate, endate), target_pdate__range=(startdate, endate))

Post a Comment for "Filter Range From Two Dates In The Same Query Django/Python"