implement issues index and detail view, using templates

This commit is contained in:
Lexi / Zoe 2019-05-27 15:18:57 +02:00
parent 43c127d744
commit a14ab33927
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
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,
})