在 views.py 上修改

...
def ordered(req): return render(req, "ordered.html") def shopping_car(req): return render(req, "shopping_car.html")

在 urls.py 上修改

...
path('ordered/', views.ordered),
path('shopping_car/', views.shopping_car),
...

在 tmplates 文件夹下创建 base.html 文件

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title> <style>
.page-header{
height:50px;
background-color: rebeccapurple;
} .page-body .menu{
height: 500px;
background-color: antiquewhite;
float: left;
width: 20%;
} .page-body .content{
height: 500px;
background-color: cornflowerblue;
float: left;
width: 80%
} .page-footer{
height:50px;
background-color: green;
clear: both;
}
</style>
</head>
<body>
<div>
<div class="page-header"></div>
<div class="page-body">
<div class="menu">
<a href="/ordered/">订单</a><br>
<a href="/shopping_car/">购物车</a>
</div> {% block content %} {% endblock %} </div>
<div class="page-footer"></div>
</div> </body>
</html>

ordered.html 文件

{% extends "base.html" %}

{% block content %}
<div class="content">
订单
</div>
{% endblock %}

shopping_car.html 文件

{% extends "base.html" %}

{% block content %}
<div class="content">
购物车
</div>
{% endblock %}

效果如下:

最新文章

  1. 使用Nito.AsyncEx实现异步锁(转)
  2. BZOJ 1305: [CQOI2009]dance跳舞 二分+最大流
  3. 第 15 章 CSS 文本样式[下]
  4. Spring Data JPA 查询方法支持的关键字
  5. Centos 安装 neo4j
  6. sencha touch api 使用指南
  7. PANIC : Error configuring AvalonLogSystem :
  8. 写Java程序让Jvm崩溃
  9. 教程-Delphi操作快捷键
  10. 无Xaml的WPF展示
  11. JSP使用JDBC ODBC 实例
  12. web page diagnostics
  13. Datatbel和 string之间的相互转换
  14. 水dp第二天(背包有关)
  15. 【CF734F】Anton and School(构造)
  16. Python学习笔记 -- 第一章
  17. stm32学习基本知识点
  18. 【kuangbin专题】计算几何_半平面交
  19. js中定时器之一
  20. highcharts柱状图实现legend和数据列一一对应效果

热门文章

  1. Dubbo介绍(一)
  2. USACO Dueling GPS&#39;s
  3. vue和react的区别
  4. Tomcat服务部署与Nginx负载均衡配置
  5. java while 循环
  6. java8 关于Set集合的线程安全使用
  7. nginx ubantu 安装步骤
  8. .NET Core应用中使用分布式缓存及内存缓存
  9. sql server 批量备份数据库及删除N天前的备份数据
  10. 释放mac磁盘空间