Tutorial 6 Build Template

This commit is contained in:
Cutty 2026-03-14 16:54:39 -06:00
parent df324bfa63
commit c22cef439b
2 changed files with 26 additions and 2 deletions

View 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>

View file

@ -1,7 +1,15 @@
from django.http import HttpResponse
from django.shortcuts import render
from .models import Tour
# from django.http import HttpResponse
# Create your views here.
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")