implement issues index and detail view, using templates
This commit is contained in:
parent
c81f9d090f
commit
880d2f8db4
4 changed files with 34 additions and 4 deletions
|
|
@ -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,
|
||||
})
|
||||
|
|
|
|||
Reference in a new issue