Opened 12 months ago

Last modified 12 months ago

#22316 assigned New feature

TimeFIeld lacks hour/minute filters

Reported by: dracos Owned by: mjtamlyn
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


#8424 added hour/minute/second filter lookups to DateTimeField, but not TimeField. I'm not sure if this was deliberate, but it would seem useful to have the functionality on TimeFields too if possible.

A workaround is to use a DateTimeField and hide/set the date part within the model.

Change History (5)

comment:1 Changed 12 months ago by charettes

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from 1.6 to master

From the discussion on #8424 it looks like those lookups were only added to DateTimeField to prevent possible clashes due to ORM limitations.

Now that the ORM lookup system has been overhauled (see #16187) it looks like django.db.lookups.DateLookup could be refactored to also account for TimeField.

comment:2 Changed 12 months ago by mjtamlyn

  • Owner changed from nobody to mjtamlyn
  • Status changed from new to assigned

comment:3 Changed 12 months ago by aaugustin

I added the lookups to DateTimeField despite the potential for clashes. I was working in the context of time zone support and simply didn't think about TimeField.

comment:4 Changed 12 months ago by omer.drow@…

Will this be implemented in 1.7?

comment:5 Changed 12 months ago by aaugustin

No, 1.7 is feature frozen.

Note: See TracTickets for help on using tickets.
Back to Top