-
本节是完成前台大堂点餐系统结构搭建,并且将网站首页(大堂点餐首页),订单列表界面摆放到web项目中
-
由于二个网页界面都有公共的页头,故采用模板继承来实现网页布局:
(1). 开发前的准备工作:
-
安装项目设计创建对象的文件和目录
-
将素材下的提前准备好模板目录中的静态资源目录static/下的文件夹:css、js、images和fonts 复制到项目的static/web/目录下。(需要的可以联系我)
(2). 目urls路由信息配置:
from django.urls import path
from web.views import index
urlpatterns = [
path('', index.index, name="index"), #前台大堂点餐首页
]
(3). 编辑视图文件
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
'''项目前台大堂点餐首页'''
return render(request,"web/index.html")
(4). 编写模板文件
-
使用模板继承套用模板文件:base.html(选做,这里没有使用父模板)、index.html具体如下
{% load static %}
Title
购 物 车
安装项目设计创建对象的文件和目录
将素材下的提前准备好模板目录中的静态资源目录static/下的文件夹:css、js、images和fonts 复制到项目的static/web/目录下。(需要的可以联系我)
from django.urls import path
from web.views import index
urlpatterns = [
path('', index.index, name="index"), #前台大堂点餐首页
]
(3). 编辑视图文件
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
'''项目前台大堂点餐首页'''
return render(request,"web/index.html")
(4). 编写模板文件
-
使用模板继承套用模板文件:base.html(选做,这里没有使用父模板)、index.html具体如下
{% load static %}
Title
购 物 车
-
使用模板继承套用模板文件:base.html(选做,这里没有使用父模板)、index.html具体如下
{% load static %}
Title
购 物 车
| 序 | 菜品 | 数量 | 单价 | 删除 |
|---|---|---|---|---|
| 1 | 梅菜扣肉+番茄鸡蛋 | - 1 + | 38.00 | 删除 |
| 2 | 梅菜扣肉 | - 1 + | 25.00 | 删除 |
| 2 | 梅菜扣肉 | - 1 + | 25.00 | 删除 |
| 2 | 梅菜扣肉 | - 1 + | 25.00 | 删除 |
双拼套餐: 梅菜扣肉+番茄鸡蛋 ¥25.00元 购买 梅菜扣肉+番茄鸡蛋 ¥25.00元 购买 梅菜扣肉+番茄鸡蛋 ¥25.00元 购买 梅菜扣肉+番茄鸡蛋 ¥25.00元 购买 梅菜扣肉+番茄鸡蛋 ¥25.00元 购买 梅菜扣肉+番茄鸡蛋
¥25.00元 购买
梅菜扣肉+番茄鸡蛋¥25.00元 购买
梅菜扣肉+番茄鸡蛋¥25.00元 购买
梅菜扣肉+番茄鸡蛋¥25.00元 购买
梅菜扣肉+番茄鸡蛋¥25.00元 购买



