from django.shortcuts import render, get_object_or_404 from .models import Country from django.http import HttpResponse def index(request): countries = Country.objects.order_by("name").filter(longitude_degrees__isnull=False) return render(request, "factbook/map.html", {"countries":countries}) def country(request, country_id): c = get_object_or_404(Country, id = country_id) return render(request, "factbook/country.html", {"country":c}) # return HttpResponse("You're looking at %s." % c.name)