[Django] #36616: Add DatabaseOperations.adapt_durationfield_value() hook

7 views
Skip to first unread message

Django

unread,
Sep 19, 2025, 8:27:24 PM (4 days ago) Sep 19
to django-...@googlegroups.com
#36616: Add DatabaseOperations.adapt_durationfield_value() hook
-------------------------------------+-------------------------------------
Reporter: Tim | Owner: Tim Graham
Graham |
Type: New | Status: assigned
feature |
Component: Database | Version: dev
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The MongoDB backend has to [https://github.com/mongodb/django-mongodb-
backend/blob/f8c95289d6555d8e135e7177dc43576c01179360/django_mongodb_backend/fields/duration.py#L7-L14
monkeypatch] `DurationField.get_db_prep_value()` to adapt the value sent
to the database.

Following the pattern of other fields, a
`DatabaseOperations.adapt_durationfield_value()` hook could be added to
remedy this.
--
Ticket URL: <https://code.djangoproject.com/ticket/36616>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 19, 2025, 9:05:10 PM (4 days ago) Sep 19
to django-...@googlegroups.com
#36616: Add DatabaseOperations.adapt_durationfield_value() hook
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
| Graham
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1

Comment:

[https://github.com/django/django/pull/19886 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/36616#comment:1>

Django

unread,
Sep 22, 2025, 3:09:57 AM (yesterday) Sep 22
to django-...@googlegroups.com
#36616: Add DatabaseOperations.adapt_durationfield_value() hook
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
| Graham
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Unreviewed => Accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/36616#comment:2>

Django

unread,
12:36 PM (4 hours ago) 12:36 PM
to django-...@googlegroups.com
#36616: Add DatabaseOperations.adapt_durationfield_value() hook
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
| Graham
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36616#comment:3>

Django

unread,
12:36 PM (4 hours ago) 12:36 PM
to django-...@googlegroups.com
#36616: Add DatabaseOperations.adapt_durationfield_value() hook
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
| Graham
Type: New feature | Status: closed
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"1acb00b26da13165e967bf2354fc917e38c382e4" 1acb00b]:
{{{#!CommitTicketReference repository=""
revision="1acb00b26da13165e967bf2354fc917e38c382e4"
Fixed #36616 -- Added DatabaseOperations.adapt_durationfield_value().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36616#comment:4>
Reply all
Reply to author
Forward
0 new messages