Refs #31223 -- Added __class_getitem__() to ForeignKey.
This commit is contained in:
parent
eeb0bb6379
commit
0de89b6f8d
|
@ -978,6 +978,9 @@ class ForeignKey(ForeignObject):
|
|||
)
|
||||
self.db_constraint = db_constraint
|
||||
|
||||
def __class_getitem__(cls, *args, **kwargs):
|
||||
return cls
|
||||
|
||||
def check(self, **kwargs):
|
||||
return [
|
||||
*super().check(**kwargs),
|
||||
|
|
|
@ -164,3 +164,6 @@ class ForeignKeyTests(TestCase):
|
|||
|
||||
class MyModel(models.Model):
|
||||
child = models.ForeignKey(1, models.CASCADE)
|
||||
|
||||
def test_manager_class_getitem(self):
|
||||
self.assertIs(models.ForeignKey["Foo"], models.ForeignKey)
|
||||
|
|
Loading…
Reference in New Issue