[Django] #34915: do not autopopulate _order field for model with an order_with_respect_to if already set

14 views
Skip to first unread message

Django

unread,
Oct 20, 2023, 4:04:05 AM10/20/23
to django-...@googlegroups.com
#34915: do not autopopulate _order field for model with an order_with_respect_to if
already set
-------------------------------------+-------------------------------------
Reporter: Tilman | Owner: nobody
Koschnick |
Type: | Status: new
Uncategorized |
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: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
If a model has the Meta option "order_with_respect_to", new instances of
the model have the _order field autopopulated, no matter if the _order
field is already set or not. I propose to only set the field if it has not
previously been set already, allowing a custom order to be set before
saving new objects, and saving a query to the database in this case.

This will not affect existing code that does not explicitly set the _order
field before saving the object.

--
Ticket URL: <https://code.djangoproject.com/ticket/34915>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 20, 2023, 4:04:15 AM10/20/23
to django-...@googlegroups.com
#34915: do not autopopulate _order field for model with an order_with_respect_to if
already set
-------------------------------------+-------------------------------------
Reporter: Tilman Koschnick | Owner: nobody
Type: Uncategorized | Status: new
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 Tilman Koschnick):

* Attachment "base.diff" added.

Django

unread,
Oct 20, 2023, 4:09:51 AM10/20/23
to django-...@googlegroups.com

Django

unread,
Oct 20, 2023, 4:09:51 AM10/20/23
to django-...@googlegroups.com
#34915: do not autopopulate _order field for model with an order_with_respect_to if
already set
-------------------------------------+-------------------------------------
Reporter: Tilman Koschnick | Owner: nobody
Type: Uncategorized | Status: new
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 Tilman Koschnick):

* Attachment "base.diff" removed.

Reply all
Reply to author
Forward
0 new messages