About Constants in Django
Keep model-related constants at the model level instead of the module level. You can save some extra imports in the views, forms or middlewares, and will have a clear namespace.
articles/models.py:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
1 2 3 4 5 6 |
|
Tips and Tricks Programming Architecture Django 5.x Django 4.2 Django 3.2
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.