For some reasons I'm required to store date as string 2023-03-03
and I have a requirement to filter this data using date range.
Given starting date (say 2023-03-01
) and end date (2023-03-04
) I have to find all the rows between the given dates.
Currently I'm using this query
Sample.objects.filter(date__range=["2011-01-01", "2011-01-31"])
which is giving results.
I'm not able to understand how it is working. I'm looking to see if this approach I'm following is right of if there's better approach to query this data.