implement issues index and detail view, using templates

This commit is contained in:
Lexi Stelter 2019-05-27 15:18:57 +02:00
parent c81f9d090f
commit 880d2f8db4
4 changed files with 34 additions and 4 deletions

View file

@ -1,6 +1,17 @@
# from django.shortcuts import render
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render
from .models import Issue
def index(request):
return HttpResponse('Hello Tofu.')
issue_list = Issue.objects.order_by('create_date')
return render(request, 'issues/index.html', {
'issue_list': issue_list,
})
def detail(request, issue_id):
issue = get_object_or_404(Issue, pk=issue_id)
return render(request, 'issues/detail.html', {
'issue': issue,
})