Created
September 11, 2020 06:42
-
-
Save ulgens/b8f14ce81ee8d115f38a975bcee9cebf to your computer and use it in GitHub Desktop.
Get counts from all models in Django
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import django.apps | |
models = django.apps.apps.get_models() | |
for model in models: | |
print(model, model.objects.count()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment