[Django] #36100: get_next_by_FIELD() check for unsaved objects should account for composite primary keys

9 views
Skip to first unread message

Django

unread,
Jan 15, 2025, 7:54:26 AM1/15/25
to django-...@googlegroups.com
#36100: get_next_by_FIELD() check for unsaved objects should account for composite
primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Jacob Walls
Walls |
Type: | Status: assigned
Cleanup/optimization |
Component: Database | Version: dev
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
[https://github.com/django/django/pull/19050 PR] to keep the check for
unsaved objects at the top of `get_next_by_FIELD()` compatible with
unsaved objects having composite primary keys.

More of a cleanup (?), since ValueError was still being raised at the ORM
level:
{{{
AssertionError: 'get_next/get_previous cannot be used on unsaved objects.'
not found in 'Cannot use None as a query value'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36100>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 15, 2025, 8:24:25 AM1/15/25
to django-...@googlegroups.com
#36100: get_next_by_FIELD() check for unsaved objects should account for composite
primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | 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: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted

Comment:

Thank you!
--
Ticket URL: <https://code.djangoproject.com/ticket/36100#comment:1>

Django

unread,
Jan 15, 2025, 8:25:51 AM1/15/25
to django-...@googlegroups.com
#36100: get_next_by_FIELD() check for unsaved objects should account for composite
primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | 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: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

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

Django

unread,
Jan 15, 2025, 11:23:56 AM1/15/25
to django-...@googlegroups.com
#36100: get_next_by_FIELD() check for unsaved objects should account for composite
primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | 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: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

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

Comment:

In [changeset:"1602666b79ab438930b74b576f2fa1b6bcf0377b" 1602666]:
{{{#!CommitTicketReference repository=""
revision="1602666b79ab438930b74b576f2fa1b6bcf0377b"
Fixed #36100 -- Checked if composite pk is set in get_next/get_previous.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36100#comment:3>
Reply all
Reply to author
Forward
0 new messages