Skip to content

Instantly share code, notes, and snippets.

@ulgens
Created September 11, 2020 06:42
Show Gist options
  • Save ulgens/b8f14ce81ee8d115f38a975bcee9cebf to your computer and use it in GitHub Desktop.
Save ulgens/b8f14ce81ee8d115f38a975bcee9cebf to your computer and use it in GitHub Desktop.
Get counts from all models in Django
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