##// END OF EJS Templates
Since we show sections on the landing page now, always show all tags in the tags view
Since we show sections on the landing page now, always show all tags in the tags view

File last commit:

r1727:2927138c default
r1741:58ced8b0 default
Show More
statistics.py
28 lines | 883 B | text/x-python | PythonLexer
from django.core.management import BaseCommand
from boards.models import Attachment
from boards.utils import get_domain
class Command(BaseCommand):
help = 'Gather board statistics'
def handle(self, *args, **options):
domains = {}
for attachment in Attachment.objects.exclude(url=None):
full_domain = attachment.url.split('/')[2]
domain = get_domain(full_domain)
if domain in domains:
domains[domain] += 1
else:
domains[domain] = 1
print('* Domains and their usage')
for domain in domains:
print('{}: {}'.format(domain, domains[domain]))
print('* Overall numbers')
print('{} attachments in the system, {} of them as URLs'.format(
Attachment.objects.count(),
Attachment.objects.exclude(url=None).count()))