-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviews.py
More file actions
29 lines (22 loc) · 1015 Bytes
/
views.py
File metadata and controls
29 lines (22 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from django.shortcuts import redirect, render
from backend.models import FoodItem, BookTable
# Create your views here.
def index(request):
return render(request, 'index.html', {'FoodItems' : FoodItem.objects.all()})
def menu(request):
return render(request, 'menu.html', {'FoodItems' : FoodItem.objects.all()})
def book(request):
return render(request, 'book.html')
def submit(request):
if request.method == 'POST':
name = request.POST["Name"]
email_address = request.POST["Email"]
phone_number = int(request.POST["Phone_Number"])
number_of_persons = int(request.POST["number"])
date = request.POST["Date"]
BookTable(name=name, email=email_address, phone_number=phone_number,
number_of_persons=number_of_persons, date=date).save()
print(name, email_address, phone_number, number_of_persons, date)
return render(request, 'index.html')
def about(request):
return render(request, 'about.html')