Dynamic Model with Foreign Key

142 views
Skip to first unread message

Roman Akopov

unread,
Sep 5, 2017, 10:46:34 AM9/5/17
to Django developers (Contributions to Django itself)
Hi,

I need a comment by Django developer, because I feel like things I am asking about are too complex for users mailing list. Start of discussion is here.

https://groups.google.com/forum/#!topic/django-users/_u83xxJOIFU

TL/DR

Is it impossible to get reverse relation to dynamically added model? I mean because Option._relation_tree is calculated just once and there is no way (even undocumented internal API) to reset it after dynamic model with ForeignKey was created, there is no way to add reverse relation field to existing model, so _meta._get_fields() of preexisting model does not include relation to newly added dynamic model.

So, am I right, in particular, and what is level of support for dynamic models? Is it above "use at your own risk"?

Roman

Tim Graham

unread,
Sep 5, 2017, 12:27:52 PM9/5/17
to Django developers (Contributions to Django itself)
Hi, there's nothing in the Django documentation about dynamic models, so there's no official support for it. I'm not aware of any recent discussions about it but searching this mailing list's archives for "dynamic models" or searching Google for "django dynamic models" might yield something useful.
Reply all
Reply to author
Forward
0 new messages