from django.shortcuts import render from bgpdata.models import CrawlRun, AS, Peering from django.core.paginator import Paginator def overview(request): crawls = CrawlRun.objects.order_by("-startTime") crawlsPage = Paginator(crawls, 200) return render(request, 'bgpdata/overview.html', {"crawls": crawlsPage.page(1)}) def showMap(request, crawlId): crawl = None try: crawl = CrawlRun.objects.get(id=crawlId) except CrawlRun.DoesNotExist: return render(request, "bgpdata/no-map-found.html", {"crawl_id": crawlId}) 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})