dms/jci/views.py

23 lines
786 B
Python

from django.shortcuts import render
from jci.models import Intent, Section, Standard
def home(request):
return render(request, 'jci/home.html', {})
def jci_list(request):
sections = Section.objects.prefetch_related('headlines').prefetch_related('headlines__standards')
return render(request, 'jci/list.html', {'sections': sections})
def get_intent(request, intent_id):
intent = Intent.objects.prefetch_related('standards').get(pk=intent_id)
return render(request, 'jci/intent/details.html', {'intent': intent})
def get_standard(request, standard_id):
standard = Standard.objects.select_related('intent').select_related('headline').get(pk=standard_id)
return render(request, 'jci/standard/details.html', {'standard': standard})