Opened 7 months ago

Closed 7 months ago

#34915 closed New feature (wontfix)

Do not autopopulate _order field for model with an order_with_respect_to if already set.

Reported by: Tilman Koschnick Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Attachments (1)

base.diff (659 bytes ) - added by Tilman Koschnick 7 months ago.

Download all attachments as: .zip

Change History (2)

by Tilman Koschnick, 7 months ago

Attachment: base.diff added

comment:1 by Mariusz Felisiak, 7 months ago

Has patch: unset
Resolution: wontfix
Status: newclosed
Summary: do not autopopulate _order field for model with an order_with_respect_to if already setDo not autopopulate _order field for model with an order_with_respect_to if already set.
Type: UncategorizedNew feature

Thanks for this ticket, however, I don't understand why you want to set ordering with respect to the given field and in the same time set it manually. It seems that you should use your own custom logic for ordering and disable order_with_respect_to. The proposed behavior would be confusing and counterintuitive.

You can start a discussion on DevelopersMailingList if you don't agree, where you'll reach a wider audience and see what other think.

Note: See TracTickets for help on using tickets.
Back to Top