mirror of
https://github.com/django/django.git
synced 2025-04-04 13:36:42 +00:00
Fixed #34566 : ModelAdmin get_field_queryset uses related admin ordering, but not related admin querysets.
This commit is contained in:
parent
729266c6f2
commit
27252c911d
@ -259,11 +259,13 @@ class BaseModelAdmin(metaclass=forms.MediaDefiningClass):
|
||||
except NotRegistered:
|
||||
return None
|
||||
else:
|
||||
ordering = related_admin.get_ordering(request)
|
||||
if ordering is not None and ordering != ():
|
||||
return db_field.remote_field.model._default_manager.using(db).order_by(
|
||||
*ordering
|
||||
)
|
||||
if related_admin is not None:
|
||||
ordering = related_admin.get_ordering(request)
|
||||
if ordering is not None and ordering != ():
|
||||
queryset = related_admin.get_queryset(request)
|
||||
if db:
|
||||
queryset = queryset.using(db)
|
||||
return queryset.order_by(*ordering)
|
||||
return None
|
||||
|
||||
def formfield_for_foreignkey(self, db_field, request, **kwargs):
|
||||
|
Loading…
x
Reference in New Issue
Block a user