* type: Uncategorized => Bug
* stage: Unreviewed => Accepted
Comment:
OK, happy to look at a patch — assuming nothing breaks...
It'd be a change in behaviour, so would need calling out in the release
notes.
--
Ticket URL: <https://code.djangoproject.com/ticket/31750#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Ryan Hiebert (added)
* owner: nobody => Ryan Hiebert
* has_patch: 0 => 1
* status: new => assigned
Comment:
[https://github.com/django/django/pull/13124 PR]
Should this get backported? It feels like an (admittedly esoteric) bug fix
to me. It affects ordering, though I've minimized that effect to only
places where the ordering is currently undefined, as they are currently
considered equal.
--
Ticket URL: <https://code.djangoproject.com/ticket/31750#comment:2>
Comment (by Nicolas Delaby):
Hi, I wonder if the submitted fix didn't introduce a subtle regression.
Given the example posted in the description, how would you evaluate the
following statements ?
**before**
https://github.com/django/django/commit/502e75f9ed5476ffe8229109acf0c23999d4b533
{{{#!python
assert B._meta.get_field('myfield') == C._meta.get_field('myfield')
assert B._meta.get_field('myfield') == A._meta.get_field('myfield')
assert C._meta.get_field('myfield') == A._meta.get_field('myfield')
}}}
**after**
https://github.com/django/django/commit/502e75f9ed5476ffe8229109acf0c23999d4b533
{{{#!python
assert B._meta.get_field('myfield') != C._meta.get_field('myfield')
assert B._meta.get_field('myfield') != A._meta.get_field('myfield')
assert C._meta.get_field('myfield') != A._meta.get_field('myfield')
}}}
What if it shouldn't be this ? Since B (or C) doesn't override
''myfield'', I would expect the subclass to evaluate equality as if the
field was defined on itself (given the parent model is abstract)
**maybe?**
{{{#!python
assert B._meta.get_field('myfield') != C._meta.get_field('myfield')
assert B._meta.get_field('myfield') == A._meta.get_field('myfield')
assert C._meta.get_field('myfield') == A._meta.get_field('myfield')
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31750#comment:4>
Comment (by Mariusz Felisiak):
> Hi, I wonder if the submitted fix didn't introduce a subtle regression.
This is an expected change IMO. Model fields don't make much sense without
models (even abstract) so we should distinguish between fields in abstract
models and the same fields inherited from them.
--
Ticket URL: <https://code.djangoproject.com/ticket/31750#comment:5>
Comment (by Nicolas Delaby):
Thanks for clarifying Mariusz.
--
Ticket URL: <https://code.djangoproject.com/ticket/31750#comment:6>