from django.shortcuts import get_object_or_404, render from django.http import HttpResponse from .models import LegislativeText, LegislationBook def index(request): legislative_texts = LegislativeText.objects.all() context = { "legislative_texts": legislative_texts, } return render(request, "explorer/index.html", context) def view_legislation(request, legislation_id): legislation = get_object_or_404(LegislativeText, pk=legislation_id) context = { "legislation": legislation, } return render(request, "explorer/legislation.html", context)