#26524: Change foreign key id list_display reference to display only the id
-------------------------------------+-------------------------------------
Reporter: cristianocca | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: contrib.admin | Version: master
Severity: Release blocker | Resolution:
Keywords: admin list_display | Triage Stage: Accepted
changelist |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by jdufresne):
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/7232 Potential fix]
If I understand the surrounding code and intentions correctly, I think the
PR fixes the regression by changing the condition from:
{{{
# Avoid coercing <FK>_id fields to FK
if field.is_relation and hasattr(field, 'attname') and field.attname
== name:
raise FieldIsAForeignKeyColumnName()
}}}
To
{{{
# Avoid coercing <FK>_id fields to FK
if field.is_relation and not field.many_to_many and hasattr(field,
'attname') and field.attname == name:
raise FieldIsAForeignKeyColumnName()
}}}
But it would help if someone with a deeper understanding of the original
change, admin, and relationship fields had a look to make sure I'm not
introducing a different edge case crash. Thanks for any feedback.
--
Ticket URL: <https://code.djangoproject.com/ticket/26524#comment:17>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.628b16049290aa4f97bae29d435ef4c8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.