[Django] #24479: models: please document that order_with_respect_to overwrites ordering / add a warning

8 views
Skip to first unread message

Django

unread,
Mar 13, 2015, 9:21:22 PM3/13/15
to django-...@googlegroups.com
#24479: models: please document that order_with_respect_to overwrites ordering /
add a warning
-------------------------------+--------------------
Reporter: blueyed | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
(In django/db/models/options.py)

1. When `order_with_respect_to` is being used, and value in `ordering`
gets silently overwritten:

self.ordering = ('_order',)

This should be documented.

2. Additionally, I am wondering if there should be a warning / hint when
this happens, i.e. when `self.ordering` is non-empty. It might be
possible to keep any existing values, and prepend/append the `_order`
value?!

3. With that code (`models.Options._prepare`), `ordering` gets set to
`('_order',)` always (see point 1), but the proxy "field" gets only added
if there's no `OrderWrt` field yet. This could lead to having an invalid
setting for `ordering`, in case there's a `OrderWrt` field that's not
named `_order`?!

I think point 1 should be addressed anyway (apart from what gets done
considering 2. and 3.).

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

Django

unread,
Mar 14, 2015, 12:00:45 PM3/14/15
to django-...@googlegroups.com
#24479: Add a system check to prevent defining both ordering and
order_with_respect_to
--------------------------------------+------------------------------------
Reporter: blueyed | Owner: nobody
Type: New feature | Status: new
Component: Core (System checks) | Version: master
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 timgraham):

* needs_better_patch: => 0
* component: Uncategorized => Core (System checks)
* needs_tests: => 0
* needs_docs: => 0
* type: Bug => New feature
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/24479#comment:1>

Django

unread,
Mar 17, 2015, 6:12:58 AM3/17/15
to django-...@googlegroups.com
#24479: Add a system check to prevent defining both ordering and
order_with_respect_to
--------------------------------------+------------------------------------
Reporter: blueyed | Owner: coldmind
Type: New feature | Status: assigned

Component: Core (System checks) | Version: master
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 coldmind):

* owner: nobody => coldmind
* status: new => assigned


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

Django

unread,
Mar 17, 2015, 10:45:21 AM3/17/15
to django-...@googlegroups.com
#24479: Add a system check to prevent defining both ordering and
order_with_respect_to
--------------------------------------+------------------------------------
Reporter: blueyed | Owner: coldmind
Type: New feature | Status: assigned
Component: Core (System checks) | Version: master
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 jdufresne):

* cc: jon.dufresne@… (added)
* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/4343

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

Django

unread,
Mar 17, 2015, 10:48:27 AM3/17/15
to django-...@googlegroups.com
#24479: Add a system check to prevent defining both ordering and
order_with_respect_to
--------------------------------------+------------------------------------
Reporter: blueyed | Owner:
Type: New feature | Status: new
Component: Core (System checks) | Version: master
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 coldmind):

* owner: coldmind =>
* status: assigned => new


Comment:

@jdufresne, if you decided to work on ticket, you must mark it is as
assigned to yourself, so people will see that someone is working on it
now. I spent some time on it today, and, likely, in vain.

--
Ticket URL: <https://code.djangoproject.com/ticket/24479#comment:4>

Django

unread,
Mar 17, 2015, 10:49:41 AM3/17/15
to django-...@googlegroups.com
#24479: Add a system check to prevent defining both ordering and
order_with_respect_to
--------------------------------------+------------------------------------
Reporter: blueyed | Owner:
Type: New feature | Status: new
Component: Core (System checks) | Version: master
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
--------------------------------------+------------------------------------

Comment (by jdufresne):

Sorry about that. I meant no disrespect. I will do so next time.

--
Ticket URL: <https://code.djangoproject.com/ticket/24479#comment:5>

Django

unread,
Mar 17, 2015, 11:10:07 AM3/17/15
to django-...@googlegroups.com
#24479: Add a system check to prevent defining both ordering and
order_with_respect_to
--------------------------------------+------------------------------------
Reporter: blueyed | Owner:
Type: New feature | Status: new
Component: Core (System checks) | Version: master
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 coldmind):

* cc: me@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24479#comment:6>

Django

unread,
Mar 20, 2015, 1:08:45 PM3/20/15
to django-...@googlegroups.com
#24479: Add a system check to prevent defining both ordering and
order_with_respect_to
--------------------------------------+------------------------------------
Reporter: blueyed | Owner:
Type: New feature | Status: new
Component: Core (System checks) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24479#comment:7>

Django

unread,
Mar 20, 2015, 7:27:45 PM3/20/15
to django-...@googlegroups.com
#24479: Add a system check to prevent defining both ordering and
order_with_respect_to
--------------------------------------+------------------------------------
Reporter: blueyed | Owner:
Type: New feature | Status: new
Component: Core (System checks) | Version: master
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 jdufresne):

* needs_better_patch: 1 => 0


Comment:

Updated patch based on feedback from reviews. Added additional tests and
docs. All tests are passing.

--
Ticket URL: <https://code.djangoproject.com/ticket/24479#comment:8>

Django

unread,
Mar 21, 2015, 8:19:55 AM3/21/15
to django-...@googlegroups.com
#24479: Add a system check to prevent defining both ordering and
order_with_respect_to
-------------------------------------+-------------------------------------
Reporter: blueyed | Owner: Tim
| Graham <timograham@…>
Type: New feature | Status: closed
Component: Core (System | Version: master
checks) |
Severity: Normal | Resolution: fixed

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 Tim Graham <timograham@…>):

* status: new => closed
* owner: => Tim Graham <timograham@…>
* resolution: => fixed


Comment:

In [changeset:"966a29c2b83fed2fc7c2b5b09de80cbebc94ac74" 966a29c]:
{{{
#!CommitTicketReference repository=""
revision="966a29c2b83fed2fc7c2b5b09de80cbebc94ac74"
Fixed #24479 -- Added system check to prevent both ordering and order_wrt.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24479#comment:9>

Reply all
Reply to author
Forward
0 new messages