Esempio n. 1
0
def index(request):
    metrics = []
    for MC in Metric.__subclasses__():
        metrics.extend(MC.objects.all())

    data = []
    for metric in metrics:
        latest = metric.data.latest()
        data.append({'metric': metric, 'latest': latest})
    return render(request, 'index.html', {'data': data})
Esempio n. 2
0
 def handle_noargs(self, **options):
     for MC in Metric.__subclasses__():
         for metric in MC.objects.all():
             metric.data.create(count=metric.fetch())
Esempio n. 3
0
from django.contrib import admin

from metrics.models import Data, Metric

admin.site.register(Data)

for MC in Metric.__subclasses__():
    admin.site.register(MC)
Esempio n. 4
0
from django.contrib import admin

from metrics.models import Data, Metric


admin.site.register(Data)

for MC in Metric.__subclasses__():
    admin.site.register(MC)