#8424: Implement time filters ---------------------------------------------------+------------------------ Reporter: gnuvince | Owner: UloPe Status: new | Milestone: Component: Database layer (models, ORM) | Version: Resolution: | Keywords: datetime filter hour minute second Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 1 Needs_better_patch: 1 | ---------------------------------------------------+------------------------ Comment (by ramiro):
Last thunk of latest patch {{{ --- a/tests/regressiontests/null_queries/tests.py +++ b/tests/regressiontests/null_queries/tests.py @@ -53,17 +53,17 @@ class NullQueriesTests(TestCase): """ obj = OuterA.objects.create() self.assertQuerysetEqual( - OuterA.objects.filter(inner__second=None), + OuterA.objects.filter(inner__secondary=None), ['<OuterA: OuterA object>'] ) self.assertQuerysetEqual( - OuterA.objects.filter(inner__second__data=None), + OuterA.objects.filter(inner__secondary__data=None), ['<OuterA: OuterA object>'] ) inner_obj = Inner.objects.create(first=obj) self.assertQuerysetEqual( - Inner.objects.filter(first__inner__second=None), + Inner.objects.filter(first__inner__secondary=None), ['<Inner: Inner object>'] ) }}} reveals something potentially dangerous. FTR, from a django-dev IRC channel discussion about it: {{{ cramm: hrm, looking at the patch for #8424. cramm: Specifically the last thunk. Adding new filtering lookups like 'hour', 'second', ... means there could be clashes with existing identically named model fields? cramm: I mean, in user apps Alex_Gaynor cramm: yeah, it would Alex_Gaynor: I'd much rather wait for us to have a real solution to alternate filtering, but that won't be 1.4 at the earliest carljm: cramm, Alex_Gaynor: dunno, I'm inclined to think these are obvious omissions. carljm: i.e. "wait till we have custom filtering" doesn't make sense to me. Alex_Gaynor: carljm: unless it breaks everyone's fields named hour, second, minute carljm: yes. that, of course, is icky. carljm: that shouldn't be a problem, though. can't the splitter be smarter? carljm: i.e. only DateTimeFields can have these lookups carljm: and only related fields can be traversed. carljm: you can't traverse across a DateTimeField to a related object. Alex_Gaynor: carljm: it could, ATM it's not carljm: right. so it's a "patch needs improvement" situation, then. }}} -- Ticket URL: <http://code.djangoproject.com/ticket/8424#comment:13> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.