Tutorial 6 Build Template
This commit is contained in:
parent
df324bfa63
commit
c22cef439b
2 changed files with 26 additions and 2 deletions
16
touragency/agency/templates/tours/index.html
Normal file
16
touragency/agency/templates/tours/index.html
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Asia Tours</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Asia Tours Schedule for June</h1>
|
||||||
|
<ul>
|
||||||
|
{% for tour in tours %}
|
||||||
|
<li>{{tour}}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -1,7 +1,15 @@
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
from .models import Tour
|
||||||
|
|
||||||
|
# from django.http import HttpResponse
|
||||||
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
def index(request):
|
def index(request):
|
||||||
return HttpResponse("Asian Tours Agency")
|
tours = Tour.objects.all()
|
||||||
|
context = {"tours": tours}
|
||||||
|
return render(request, "tours/index.html", context)
|
||||||
|
|
||||||
|
|
||||||
|
# return HttpResponse("Asian Tours Agency")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue