dnmapper/bgpdata/views.py

19 lines
626 B
Python
Raw Normal View History

2015-03-23 01:42:31 +01:00
from django.shortcuts import render
2015-03-27 15:33:54 +01:00
from bgpdata.models import CrawlRun, AS, Peering
2015-03-23 01:42:31 +01:00
2015-03-27 15:33:54 +01:00
def overview(request):
crawls = CrawlRun.objects.order_by("-startTime")
return render(request, 'bgpdata/overview.html', {"crawls": crawls})
def showMap(request, crawlId):
2015-03-28 22:12:42 +01:00
crawl = None
try:
crawl = CrawlRun.objects.get(id=crawlId)
except CrawlRun.DoesNotExist:
return render(request, "bgpdata/no-map-found.html", {"crawl_id": crawlId})
2015-03-27 15:33:54 +01:00
ASses = AS.objects.filter(crawl=crawl)
peerings = Peering.objects.filter(as1__crawl=crawl)
return render(request, 'bgpdata/map.html', {"crawl": crawl, 'ASses': ASses, 'peerings': peerings})