from django.shortcuts import render
from my_ra_django_app.models import Cat, Owner
from django.http import HttpResponse
# send back a text response
return HttpResponse("Hello, world. You're at the index.")
def owners(request, primary_key):
# get an owner based on the request params
owner_obj = Owner.objects.get(pk=primary_key)
# get the cats owned by this person
cat_objs = Cat.objects.filter(owner_id=owner_obj.id)
# construct a dict we'll use in the template
return render(request, "owners.html", context)