mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #32975 -- Fixed admin system check for inlines with foreign keys to proxy models.
This commit is contained in:
committed by
Mariusz Felisiak
parent
b8824e8d17
commit
0e8be73812
@@ -4,7 +4,7 @@ from django.contrib.admin import BooleanFieldListFilter, SimpleListFilter
|
||||
from django.contrib.admin.options import VERTICAL, ModelAdmin, TabularInline
|
||||
from django.contrib.admin.sites import AdminSite
|
||||
from django.core.checks import Error
|
||||
from django.db.models import F, Field, Model
|
||||
from django.db.models import CASCADE, F, Field, ForeignKey, Model
|
||||
from django.db.models.functions import Upper
|
||||
from django.forms.models import BaseModelFormSet
|
||||
from django.test import SimpleTestCase
|
||||
@@ -1121,6 +1121,33 @@ class FkNameCheckTests(CheckTestCase):
|
||||
|
||||
self.assertIsValid(TestModelAdmin, ValidationTestModel)
|
||||
|
||||
def test_proxy_model_parent(self):
|
||||
class Parent(Model):
|
||||
pass
|
||||
|
||||
class ProxyChild(Parent):
|
||||
class Meta:
|
||||
proxy = True
|
||||
|
||||
class ProxyProxyChild(ProxyChild):
|
||||
class Meta:
|
||||
proxy = True
|
||||
|
||||
class Related(Model):
|
||||
proxy_child = ForeignKey(ProxyChild, on_delete=CASCADE)
|
||||
|
||||
class InlineFkName(admin.TabularInline):
|
||||
model = Related
|
||||
fk_name = 'proxy_child'
|
||||
|
||||
class InlineNoFkName(admin.TabularInline):
|
||||
model = Related
|
||||
|
||||
class ProxyProxyChildAdminFkName(admin.ModelAdmin):
|
||||
inlines = [InlineFkName, InlineNoFkName]
|
||||
|
||||
self.assertIsValid(ProxyProxyChildAdminFkName, ProxyProxyChild)
|
||||
|
||||
|
||||
class ExtraCheckTests(CheckTestCase):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user