About Avoiding Model Imports in Models.py
To be sure that there are no circular imports and model register works correctly in Django, avoid model imports from other apps in models.py
.
For relations use the string syntax like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
To use models from other apps in your model methods, import them at the method level:
1 2 3 4 5 |
|
Tips and Tricks Programming Architecture Development Django 4.2 Django 3.2 Django 2.2 Python 3
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.