NewsBlur-viq/apps/monitor/views/newsblur_classifiers.py

26 lines
771 B
Python
Raw Normal View History

from django.views import View
from django.shortcuts import render
from apps.analyzer.models import MClassifierFeed, MClassifierAuthor, MClassifierTag, MClassifierTitle
class Classifiers(View):
def get(self, request):
data = {
'feeds': MClassifierFeed.objects.count(),
'authors': MClassifierAuthor.objects.count(),
'tags': MClassifierTag.objects.count(),
'titles': MClassifierTitle.objects.count(),
}
chart_name = "classifiers"
chart_type = "counter"
context = {
"data": data,
"chart_name": chart_name,
"chart_type": chart_type,
}
return render(request, 'monitor/prometheus_data.html', context, content_type="text/plain")