# -*- coding: utf-8 -*-

from django.core.management.base import BaseCommand
from django.db.models.loading import get_models, get_apps


class Command(BaseCommand):
    args = ''
    help = 'Show the count of every object in database.'

    def handle(self, *args, **options):
        for app in get_apps():
            if app.__name__ == "formation.models" or app.__name__ == "sync.models":
                for cl in get_models(app):
                    count = cl.objects.all().count()
                    print("%s: %d" % (cl.__name__, count))
