You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
518 B
Python

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)