I'm developping a web api using django, I have a TimeField
that stores hours:minutes:seconds, since it will be compared to a hours:minutes (without seconds) coming from the mobile app, the comparison will always fail.
here is a comparison without seconds which is returnning an empty QuerySet:
>>> journey = Journey \
... .objects \
... .filter((Q(route__departStation=1) | Q(route__stop__station_id=1)),
... (Q(route__arrivalStation=1) | Q(route__stop__station_id=1)),
... route__departDate="2019-07-31", route__departTime="10:57")
>>> journey
<QuerySet []>
and here is when I add seconds to the comparison:
>>> journey = Journey \
... .objects \
... .filter((Q(route__departStation=1) | Q(route__stop__station_id=1)),
... (Q(route__arrivalStation=1) | Q(route__stop__station_id=1)),
route__departDate="2019-07-31", route__departTime="10:57:05")
>>> journey
<QuerySet [<Journey: Journey object (1)>]>
so please, how can I prevent the seconds from being saved to the database from this TimeField(), or at least how can I limit the comparison to hours and minutes only.