Is there a way of telling django that a model having a contenttypes GenericForeignKey can only point to models from a predefined list? For example, I have 4 models: A, B, C, D and a model X that holds a GenericForeignKey. Can I tell X that only A & B are allowed for the GenericForeignKey?
Is there a way of telling django that a model having a contenttypes GenericForeignKey
Share
For example,
your apps are app and app2 and there are A, B models in app and there are C, D models in app2.
you want to see only app.A and app.B and app2.C
use limit_choices_to on ForeignKey.
check django docs for details and Q objects, app_label.
you need to write proper app_label and model. This is just code snippet
plus: I think you write wrong app_label. This can help you.