mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-04-13 09:42:01 +00:00
24 lines
770 B
Python
Executable file
24 lines
770 B
Python
Executable file
from django.shortcuts import render
|
|
from django.views import View
|
|
|
|
from apps.rss_feeds.models import MStarredStory, MStory
|
|
|
|
|
|
class Stories(View):
|
|
def get(self, request):
|
|
data = {
|
|
"stories": MStory.objects._collection.count(),
|
|
"starred_stories": MStarredStory.objects._collection.count(),
|
|
}
|
|
chart_name = "stories"
|
|
chart_type = "counter"
|
|
|
|
formatted_data = {}
|
|
for k, v in data.items():
|
|
formatted_data[k] = f'{chart_name}{{category="{k}"}} {v}'
|
|
context = {
|
|
"data": formatted_data,
|
|
"chart_name": chart_name,
|
|
"chart_type": chart_type,
|
|
}
|
|
return render(request, "monitor/prometheus_data.html", context, content_type="text/plain")
|