@@ -287,7 +287,9 @@ class UnsupportedModel(models.Model):
287
287
288
288
class DummyGenericForeignKeyModel (models .Model ):
289
289
content_type = models .ForeignKey (
290
- contenttypes .ContentType , on_delete = models .CASCADE
290
+ contenttypes .ContentType ,
291
+ on_delete = models .CASCADE ,
292
+ limit_choices_to = {"model__in" : ["person" , "dog" ]},
291
293
)
292
294
object_id = models .PositiveIntegerField ()
293
295
content_object = GenericForeignKey ("content_type" , "object_id" )
@@ -297,7 +299,11 @@ class DummyGenericRelationModel(models.Model):
297
299
298
300
class GenericForeignKeyModelWithOptionalData (models .Model ):
299
301
content_type = models .ForeignKey (
300
- contenttypes .ContentType , on_delete = models .CASCADE , blank = True , null = True
302
+ contenttypes .ContentType ,
303
+ on_delete = models .CASCADE ,
304
+ blank = True ,
305
+ null = True ,
306
+ limit_choices_to = {"model__in" : ["person" , "dog" ]},
301
307
)
302
308
object_id = models .PositiveIntegerField (blank = True , null = True )
303
309
content_object = GenericForeignKey ("content_type" , "object_id" )
0 commit comments