#24851: Reverse one-to-one relations break the admin.
-------------------------------+--------------------
Reporter: jerivas | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Including reverse one-to-one relations in `list_display` or `fields` in a
`ModelAdmin` breaks the "change_list" and "change" admin views.
The "change" view raises a `FieldError` saying the reverse one-to-one
field is unknown. The "change_list" raises `AttributeError`: 'OneToOneRel'
object has no attribute 'rel'.
I've setup a small test app here: https://gitlab.com/jerivas/one-to-one-
bug.
To reproduce:
- Clone the repo
- Install deps from requirements.txt
- Start the development server
- Visit the admin. User/pass: proj/proj
- Both the Car and Engine admins should work
- Uncomment lines 7 & 8 from `cars/admin.py`
- Both the "change_list" and "change" views of the Car admin are now
broken. The Engine admin continues to work as expected.
This worked normally in 1.6, and I just found it while updating a project
from 1.6 to 1.8. I don't know if the bug was introduced in 1.7 or 1.8.
--
Ticket URL: <https://code.djangoproject.com/ticket/24851>
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/050.c7d5ea52c87cfdde3c3019cbc99f7a45%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.