[Question] how do you get django to recognize the dynamically created Event Models during makemigrations? #147
-
I don't understand how you do this. I know the following:
Then i am lost. I still don't see how Django's makemigrations pick up the dynamically generated class. Because makemigrations is very strict abt looking for models in models.py. In your docs at https://django-pghistory.readthedocs.io/en/3.0.0/event_tracking/#using-pghistorytrack you stated
me: but how???????? UPDATEI see that there's a create_event_model method but you're accessing the tracked_model.__meta.fields and using methods like Also how do you prevent the eventmodel from facing clashes of the reverse accessor issue? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I'm adding the model to the module here. Since this is added during loading of One annoyance with this approach is that type checkers and intellisense with IDEs won't recognize these models, but one can always directly create the model |
Beta Was this translation helpful? Give feedback.
I'm adding the model to the module here. Since this is added during loading of
models.py
, Django treats it just like any other model.One annoyance with this approach is that type checkers and intellisense with IDEs won't recognize these models, but one can always directly create the model