1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #32466 -- Corrected autocomplete to_field resolution for complex cases.

In MTI or ForeignKey as primary key cases, it is required to fetch the attname
from the field instance on the remote model in order to reliably resolve the
to_field_name.

Co-authored-by: Johannes Maron <info@johanneshoppe.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
This commit is contained in:
Johannes Maron
2021-03-18 11:21:23 +01:00
committed by Carlton Gibson
parent 0b120f5d64
commit 03d0f12c82
8 changed files with 153 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ from django.contrib import admin
from .models import (
Advisor, Album, Band, Bee, Car, CarTire, Event, Inventory, Member, Profile,
School, User,
ReleaseEvent, School, User, VideoStream,
)
@@ -47,6 +47,8 @@ site.register(Member)
site.register(Band)
site.register(Event, EventAdmin)
site.register(Album, AlbumAdmin)
site.register(ReleaseEvent, search_fields=['name'])
site.register(VideoStream, autocomplete_fields=['release_event'])
site.register(Inventory)