Skip to content

Commit

Permalink
feature: added templates
Browse files Browse the repository at this point in the history
  • Loading branch information
kherin committed Jan 23, 2024
1 parent 195c1b8 commit bbee505
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
24 changes: 24 additions & 0 deletions project1/myapp/templates/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>

<body>
<!-- Add heading code -->
<h1 style="color: #495E57">
About
</h1>

<!-- Add paragraph code -->
<p>{{content.about}}</p>

<!-- Add image code -->

</body>

</html>
23 changes: 23 additions & 0 deletions project1/myapp/templates/menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>

<body>
<!-- Add heading code -->
<h1 style="color: #495E57">
Menu
</h1>

<!-- Add paragraph code -->

<!-- Add image code -->

</body>

</html>
2 changes: 2 additions & 0 deletions project1/myapp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
path('showform/', views.showform, name='showform'),
path('getform/', views.getform, name='getform'),
path("drinks/<str:drink_name>", views.drinks, name="drink_name"),
path('menu', views.menu, name='menu'),
path('about', views.about, name='about'),
]
9 changes: 9 additions & 0 deletions project1/myapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,12 @@ def drinks(request, drink_name):

choice_of_drink = drink.get(drink_name)
return HttpResponse(f'<h2>{drink_name}</h2><span>{choice_of_drink}</span>')


def menu(request):
return render(request, "menu.html")


def about(request):
about_content = {'about': "Little Lemon is a family-owned Mediterranean restaurant, focused on traditional recipes served with a modern twist. The chefs draw inspiration from Italian, Greek, and Turkish culture and have a menu of 12–15 items that they rotate seasonally. The restaurant has a rustic and relaxed atmosphere with moderate prices, making it a popular place for a meal any time of the day."}
return render(request, 'about.html', {'content': about_content})

0 comments on commit bbee505

Please sign in to comment.