1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

[3.2.x] 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.

Backport of ceb4b9ee68 from main Backport of 03d0f12c82 from main

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 6b020f3c94
commit a8fef6daaf
8 changed files with 178 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)