#30602: Raise ValueError in Extract lookups that don't work properly with DurationField. -------------------------------------+------------------------------------- Reporter: cecedille1 | Owner: | cecedille1 Type: Bug | Status: assigned Component: Database layer | Version: master (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by felixxm):
* has_patch: 1 => 0 Comment: `DurationField` is modeled in Python by [https://docs.python.org/3/library/datetime.html?highlight=timedelta#datetime.timedelta timedelta] (see [https://docs.djangoproject.com/en/2.2/ref/models/fields/#durationfield documentation]), so even with this fix it will always return 0 for `ExtractYear`, `ExtractMonth`, or `ExtractWeek` which is unexpected. We should raise `ValueError` in all such cases. -- Ticket URL: <https://code.djangoproject.com/ticket/30602#comment:4> Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.3d8a2e325db98638584ea8ade3f2ddfa%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.