blob: bbd60df69fc0862ce32a2888d2f34c8974a24b69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
import sys
import json
from django.core.management.base import BaseCommand
from archaeological_operations.models import Operation, ArchaeologicalSite
from archaeological_finds.models import Find
class Command(BaseCommand):
args = ""
help = "Json export of sums"
def handle(self, *args, **options):
data = {
"date": datetime.datetime.now().isoformat(),
"finds": Find.objects.count(),
"operations": Operation.objects.count(),
"sites": ArchaeologicalSite.objects.count(),
}
sys.stdout.write(json.dumps(data))
|