项目之图书信息管理
Posted qiaoqianshitou
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了项目之图书信息管理相关的知识,希望对你有一定的参考价值。
模型(models.py)
1 from django.db import models 2 3 4 class User(models.Model): 5 id = models.AutoField(primary_key=True) 6 name = models.CharField(max_length=16) 7 password = models.CharField(max_length=20) 8 9 10 class Publisher(models.Model): 11 id = models.AutoField(primary_key=True) 12 name = models.CharField(max_length=16) 13 14 15 class Book(models.Model): 16 id = models.AutoField(primary_key=True) 17 name = models.CharField(max_length=60) 18 publisher = models.ForeignKey(to=Publisher)
视图(views.py)
1 from django.shortcuts import HttpResponse, render, redirect 2 from app01 import models 3 4 5 def index(request): 6 return render(request, ‘index.html‘, {‘name‘: ‘alex‘, ‘hobby‘: ‘泡吧‘}) 7 8 9 def home(request): 10 return render(request, ‘home.html‘) 11 12 13 def login(request): 14 if request.method == ‘POST‘: 15 print(request.POST) # 这里的POST是提交过来的全部数据(字典) 16 # username=request.POST[‘username‘] 17 username = request.POST.get(‘username‘) 18 # password=request.POST[‘password‘] 19 password = request.POST.get(‘password‘) 20 print(username, password) 21 print(‘=‘ * 20) 22 if username == ‘aaa‘ and password == ‘aaa‘: 23 return redirect(‘https://www.cnblogs.com/linhaifeng‘) 24 # return HttpResponse(‘登录成功‘) 25 return render(request, ‘login.html‘) 26 27 28 def publisher_list(request): 29 ret = models.Publisher.objects.all() 30 print(ret) 31 return render(request, ‘publisher_list.html‘, {‘publisher_list‘: ret}) 32 33 34 def add_publisher(request): 35 if request.method == ‘POST‘: 36 add_publisher = request.POST.get(‘add_name‘) 37 models.Publisher.objects.create(name=add_publisher) 38 return redirect(‘/publisher_list/‘) 39 return render(request, ‘add_publisher.html‘) 40 41 42 def delete_publisher(request): 43 delete_id = request.GET.get(‘id‘) 44 models.Publisher.objects.get(id=delete_id).delete() 45 return redirect(‘/publisher_list/‘) 46 47 48 def edit_publisher(request): 49 if request.method == ‘POST‘: 50 edit_id = request.GET.get(‘id‘) 51 new_name = request.POST.get(‘edit_name‘) 52 edit_obj = models.Publisher.objects.get(id=edit_id) 53 edit_obj.name = new_name 54 edit_obj.save() 55 return redirect(‘/publisher_list/‘) 56 edit_id = request.GET.get(‘id‘) 57 obj = models.Publisher.objects.get(id=edit_id) 58 return render(request, ‘edit_publisher.html‘, {‘publisher‘: obj}) 59 60 61 def book_list(request): 62 ret = models.Book.objects.all() 63 print(ret) 64 return render(request, ‘book_list.html‘, {‘book_list‘: ret}) 65 66 67 def add_book(request): 68 if request.method == ‘POST‘: 69 add_book_name = request.POST.get(‘add_book‘) 70 add_publisher_id = request.POST.get(‘publisher_id‘) 71 models.Book.objects.create(name=add_book_name, publisher_id=add_publisher_id) 72 return redirect(‘/book_list/‘) 73 ret = models.Publisher.objects.all() 74 return render(request, ‘add_book.html‘, {‘publisher_list‘: ret}) 75 76 77 def delete_book(request): 78 delete_id = request.GET.get(‘id‘) 79 models.Book.objects.get(id=delete_id).delete() 80 return redirect(‘/book_list/‘) 81 82 83 def edit_book(request): 84 if request.method == ‘POST‘: 85 book_id = request.GET.get(‘id‘) 86 book_name = request.POST.get(‘edit_book_name‘) 87 publisher_id = request.POST.get(‘publisher_id‘) 88 publisher_name = models.Publisher.objects.get(id=publisher_id) 89 obj = models.Book.objects.get(id=book_id) 90 obj.name = book_name 91 obj.publisher = publisher_name 92 obj.save() 93 return redirect(‘/book_list/‘) 94 edit_id = request.GET.get(‘id‘) 95 obj = models.Book.objects.get(id=edit_id) 96 publisher = models.Publisher.objects.all() 97 return render(request, ‘edit_book.html‘, {‘book‘: obj, ‘publisher_list‘: publisher})
对应关系的文件(urls.py)
1 from django.conf.urls import url 2 from django.contrib import admin 3 from app01 import views 4 #从app01项目里导入views 5 6 urlpatterns = [ 7 url(r‘^admin/‘, admin.site.urls), 8 url(r‘^index/‘, views.index), 9 url(r‘^home/‘, views.home), 10 url(r‘^login/‘, views.login), 11 url(r‘^publisher_list/‘, views.publisher_list), 12 url(r‘^add_publisher/‘, views.add_publisher), 13 url(r‘^delete_publisher‘,views.delete_publisher), 14 url(r‘^edit_publisher/‘,views.edit_publisher), 15 url(r‘^book_list/‘,views.book_list), 16 url(r‘^add_book/‘,views.add_book), 17 url(r‘^delete_book/‘,views.delete_book), 18 url(r‘^edit_book/‘,views.edit_book), 19 ]
静态文件
书籍管理首页
1 <!DOCTYPE html> 2 <html lang="zh-CN"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 6 <meta name="viewport" content="width=device-width, initial-scale=1"> 7 <link rel="icon" href="https://v3.bootcss.com/favicon.ico"> 8 <title>修改dashboard</title> 9 <link rel="stylesheet" href="../static/bootstrap-3.3.7/css/bootstrap.min.css"> 10 <link href="../static/modify_dashboard/dashboard.css" rel="stylesheet"> 11 <style> 12 .margin-bottom { 13 margin-bottom: 15px; 14 } 15 </style> 16 </head> 17 18 <body> 19 20 <nav class="navbar navbar-inverse navbar-fixed-top"> 21 <div class="container-fluid"> 22 <div class="navbar-header"> 23 <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" 24 aria-expanded="false" aria-controls="navbar"> 25 <span class="sr-only">Toggle navigation</span> 26 <span class="icon-bar"></span> 27 <span class="icon-bar"></span> 28 <span class="icon-bar"></span> 29 </button> 30 <a class="navbar-brand" href="#">Project name</a> 31 </div> 32 <div id="navbar" class="navbar-collapse collapse"> 33 <ul class="nav navbar-nav navbar-right"> 34 <li><a href="#">Dashboard</a></li> 35 <li><a href="#">Settings</a></li> 36 <li><a href="#">Profile</a></li> 37 <li><a href="#">Help</a></li> 38 </ul> 39 <form class="navbar-form navbar-right"> 40 <input type="text" class="form-control" placeholder="Search..."> 41 </form> 42 </div> 43 </div> 44 </nav> 45 46 <div class="container-fluid"> 47 <div class="row"> 48 <div class="col-sm-3 col-md-2 sidebar"> 49 <ul class="nav nav-sidebar"> 50 <li class="active"><a href="https://v3.bootcss.com/examples/dashboard/#">Overview <span class="sr-only">(current)</span></a> 51 </li> 52 <li><a href="https://v3.bootcss.com/examples/dashboard/#">Reports</a></li> 53 <li><a href="https://v3.bootcss.com/examples/dashboard/#">Analytics</a></li> 54 <li><a href="https://v3.bootcss.com/examples/dashboard/#">Export</a></li> 55 </ul> 56 <ul class="nav nav-sidebar"> 57 <li><a href="https://v3.bootcss.com/examples/dashboard/">Nav item</a></li> 58 <li><a href="https://v3.bootcss.com/examples/dashboard/">Nav item again</a></li> 59 <li><a href="https://v3.bootcss.com/examples/dashboard/">One more nav</a></li> 60 <li><a href="https://v3.bootcss.com/examples/dashboard/">Another nav item</a></li> 61 <li><a href="https://v3.bootcss.com/examples/dashboard/">More navigation</a></li> 62 </ul> 63 <ul class="nav nav-sidebar"> 64 <li><a href="https://v3.bootcss.com/examples/dashboard/">Nav item again</a></li> 65 <li><a href="https://v3.bootcss.com/examples/dashboard/">One more nav</a></li> 66 <li><a href="https://v3.bootcss.com/examples/dashboard/">Another nav item</a></li> 67 </ul> 68 </div> 69 <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> 70 <h1 class="page-header">图书信息管理系统</h1> 71 72 <div class="row placeholders"> 73 <div class="panel panel-primary"> 74 <div class="panel-heading"> 75 <h3 class="panel-title">书籍管理</h3> 76 </div> 77 <div class="panel-body"> 78 <!--搜索框和新增按钮--> 79 <div class="row margin-bottom"> 80 <div class="col-md-3"> 81 <div class="input-group"> 82 <input type="text" class="form-control" placeholder="Search for..."> 83 <span class="input-group-btn"> 84 <button class="btn btn-default" type="button">Go!</button> 85 </span> 86 </div><!-- /input-group --> 87 </div><!-- /.col-lg-6 --> 88 <div class="col-md-3 col-md-push-6"> 89 <a href="/add_book/" class="btn btn-info pull-right">添加新信息</a> 90 <button class="btn btn-success" data-target="#mymodal" data-toggle="modal">新增</button> 91 </div> 92 </div> 93 <!--数据表格--> 94 <div class="table-responsive"> 95 <table class="table table-striped table-bordered"> 96 <thead> 97 <tr> 98 <th class="text-center">序号</th> 99 <th class="text-center">名称</th> 100 <th class="text-center">出版社</th> 101 <th class="text-center">操作</th> 102 </tr> 103 </thead> 104 <tbody> 105 {% for book in book_list %} 106 <tr> 107 <td class="text-center">{{ forloop.counter }}</td> 108 <td class="text-center">{{ book.name }}</td> 109 <td class="text-center">{{ book.publisher.name}}</td> 110 <td class="text-center"> 111 <a href="/edit_book/?id={{ book.id }}" class="btn btn-primary btn-sm"><span 112 class="glyphicon glyphicon-pencil" 113 aria-hidden="true"></span>编辑 114 </a> 115 <a href="/delete_book/?id={{ book.id }}" class="btn btn-danger btn-sm"><span 116 class="glyphicon glyphicon-trash" 117 aria-hidden="true"></span>删除 118 </a> 119 </td> 120 </tr> 121 {% endfor %} 122 </tbody> 123 </table> 124 </div> 125 <!--分页按钮--> 126 <nav aria-label="Page navigation" class="pull-right"> 127 <ul class="pagination"> 128 <li> 129 <a href="#" aria-label="Previous"> 130 <span aria-hidden="true">«</span> 131 </a> 132 </li> 133 <li><a href="#">1</a></li> 134 <li><a href="#">2</a></li> 135 <li><a href="#">3</a></li> 136 <li><a href="#">4</a></li> 137 <li><a href="#">5</a></li> 138 <li> 139 <a href="#" aria-label="Next"> 140 <span aria-hidden="true">»</span> 141 </a> 142 </li> 143 </ul> 144 </nav> 145 </div> 146 </div> 147 </div> 148 </div> 149 </div> 150 </div> 151 152 <!--模态框--> 153 <div class="modal fade" tabindex="-1" role="dialog" id="mymodal"> 154 <div class="modal-dialog" role="document"> 155 <div class="modal-content"> 156 <div class="modal-header"> 157 <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 158 <span aria-hidden="true">×</span></button> 159 <h4 class="modal-title">添加新信息</h4> 160 </div> 161 <div class="modal-body"> 162 <form class="form-horizontal"> 163 <div class="form-group"> 164 <label for="inputName3" class="col-sm-3 control-label">出版社名称</label> 165 <div class="col-sm-4"> 166 <input type="email" class="form-control" id="inputName3" placeholder=""> 167 </div> 168 </div> 169 <div class="form-group"> 170 <label for="inputAddress3" class="col-sm-3 control-label">出版社地址</label> 171 <div class="col-sm-4"> 172 <input type="password" class="form-control" id="inputAddress3" placeholder=""> 173 </div> 174 </div> 175 </form> 176 </div> 177 <div class="modal-footer"> 178 <button type="button" class="btn btn-default" data-dismiss="modal">取消</button> 179 <button type="button" class="btn btn-primary">保存</button> 180 </div> 181 </div><!-- /.modal-content --> 182 </div><!-- /.modal-dialog --> 183 </div><!-- /.modal --> 184 185 <script src="../static/js/jquery-3.3.1.min.js"></script> 186 <script src="../static/bootstrap-3.3.7/js/bootstrap.min.js"></script> 187 </body> 188 </html>
书籍添加页面
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1"> 6 <title>Title</title> 7 <link rel="stylesheet" href="../static/bootstrap-3.3.7/css/bootstrap.min.css"> 8 </head> 9 <body> 10 <div class="container-fluid"> 11 <div class="row"> 12 <h1 class="text-center">添加书籍信息</h1> 13 <form class="form-horizontal" method="post" action="/add_book/"> 14 <div class="form-group"> 15 <label for="inputName3" class="col-md-2 col-md-push-3 control-label">书籍名字</label> 16 <div class="col-md-3 col-md-push-3"> 17 <input type="text" class="form-control" id="inputName3" name="add_book"> 18 </div> 19 </div> 20 <div class="form-group"> 21 <label for="inputName3" class="col-md-2 col-md-push-3 control-label">出版社名字</label> 22 <div class="col-md-3 col-md-push-3"> 23 <select class="form-control" name="publisher_id"> 24 {% for publisher in publisher_list %} 25 <option value="{{ publisher.id }}">{{ publisher.name }}</option> 26 {% endfor %} 27 </select> 28 </div> 29 </div> 30 <div class="form-group"> 31 <div class="col-md-offset-5 col-md-10"> 32 <button type="submit" class="btn btn-default">提交</button> 33 </div> 34 </div> 35 </form> 36 </div> 37 </div> 38 </body> 39 </html>
书籍编辑页面
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1"> 6 <title>Title</title> 7 <link rel="stylesheet" href="../static/bootstrap-3.3.7/css/bootstrap.min.css"> 8 </head> 9 <body> 10 <div class="container-fluid"> 11 <div class="row"> 12 <div class="page-header"> 13 <h1 class="text-center">编辑书籍 14 </h1> 15 </div> 16 <div class="panel panel-primary col-md-6 col-md-offset-3"> 17 <div class="panel-heading"> 18 <h3 class="panel-title">Panel title</h3> 19 </div> 20 <div class="panel-body"> 21 <form class="form-horizontal" method="post" action="/edit_book/?id={{ book.id }}"> 22 <div class="form-group"> 23 <label for="inputName3" class="col-md-2 col-md-push-3 control-label">书籍名字</label> 24 <div class="col-md-3 col-md-push-3"> 25 <input type="text" class="form-control" id="inputName3" name="edit_book_name" 26 value="{{ book.name }}"> 27 </div> 28 </div> 29 <div class="form-group"> 30 <label for="inputName3" class="col-md-2 col-md-push-3 control-label">出版社名字</label> 31 <div class="col-md-3 col-md-push-3"> 32 <select class="form-control" name="publisher_id"> 33 {% for publisher in publisher_list %} 34 {% if publisher.id == book.publisher.id %} 35 <option value="{{ publisher.id }}" selected>{{ publisher.name }}</option> 36 {% else %} 37 <option value="{{ publisher.id }}">{{ publisher.name }}</option> 38 {% endif %} 39 {% endfor %} 40 </select> 41 </div> 42 </div> 43 <div class="form-group"> 44 <div class="col-md-offset-5 col-md-10"> 45 <button type="submit" class="btn btn-default">提交</button> 46 </div> 47 </div> 48 </form> 49 </div> 50 </div> 51 </div> 52 </div> 53 </body> 54 </html>
出版社管理的首页
1 <!DOCTYPE html> 2 <html lang="zh-CN"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 6 <meta name="viewport" content="width=device-width, initial-scale=1"> 7 <link rel="icon" href="https://v3.bootcss.com/favicon.ico"> 8 <title>修改dashboard</title> 9 <link rel="stylesheet" href="../static/bootstrap-3.3.7/css/bootstrap.min.css"> 10 <link href="../static/modify_dashboard/dashboard.css" rel="stylesheet"> 11 <style> 12 .margin-bottom { 13 margin-bottom: 15px; 14 } 15 </style> 16 </head> 17 18 <body> 19 20 <nav class="navbar navbar-inverse navbar-fixed-top"> 21 <div class="container-fluid"> 22 <div class="navbar-header"> 23 <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" 24 aria-expanded="false" aria-controls="navbar"> 25 <span class="sr-only">Toggle navigation</span> 26 <span class="icon-bar"></span> 27 <span class="icon-bar"></span> 28 <span class="icon-bar"></span> 29 </button> 30 <a class="navbar-brand" href="#">Project name</a> 31 </div> 32 <div id="navbar" class="navbar-collapse collapse"> 33 <ul class="nav navbar-nav navbar-right"> 34 <li><a href="#">Dashboard</a></li> 35 <li><a href="#">Settings</a></li> 36 <li><a href="#">Profile</a></li> 37 <li><a href="#">Help</a></li> 38 </ul> 39 <form class="navbar-form navbar-right"> 40 <input type="text" class="form-control" placeholder="Search..."> 41 </form> 42 </div> 43 </div> 44 </nav> 45 46 <div class="container-fluid"> 47 <div class="row"> 48 <div class="col-sm-3 col-md-2 sidebar"> 49 <ul class="nav nav-sidebar"> 50 <li class="active"><a href="https://v3.bootcss.com/examples/dashboard/#">Overview <span class="sr-only">(current)</span></a> 51 </li> 52 <li><a href="https://v3.bootcss.com/examples/dashboard/#">Reports</a></li> 53 <li><a href="https://v3.bootcss.com/examples/dashboard/#">Analytics</a></li> 54 <li><a href="https://v3.bootcss.com/examples/dashboard/#">Export</a></li> 55 </ul> 56 <ul class="nav nav-sidebar"> 57 <li><a href="https://v3.bootcss.com/examples/dashboard/">Nav item</a></li> 58 <li><a href="https://v3.bootcss.com/examples/dashboard/">Nav item again</a></li> 59 <li><a href="https://v3.bootcss.com/examples/dashboard/">One more nav</a></li> 60 <li><a href="https://v3.bootcss.com/examples/dashboard/">Another nav item</a></li> 61 <li><a href="https://v3.bootcss.com/examples/dashboard/">More navigation</a></li> 62 </ul> 63 <ul class="nav nav-sidebar"> 64 <li><a href="https://v3.bootcss.com/examples/dashboard/">Nav item again</a></li> 65 <li><a href="https://v3.bootcss.com/examples/dashboard/">One more nav</a></li> 66 <li><a href="https://v3.bootcss.com/examples/dashboard/">Another nav item</a></li> 67 </ul> 68 </div> 69 <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> 70 <h1 class="page-header">图书信息管理系统</h1> 71 72 <div class="row placeholders"> 73 <div class="panel panel-primary"> 74 <div class="panel-heading"> 75 <h3 class="panel-title">出版社管理</h3> 76 </div> 77 <div class="panel-body"> 78 <!--搜索框和新增按钮--> 79 <div class="row margin-bottom"> 80 <div class="col-md-3"> 81 <div class="input-group"> 82 <input type="text" class="form-control" placeholder="Search for..."> 83 <span class="input-group-btn"> 84 <button class="btn btn-default" type="button">Go!</button> 85 </span> 86 </div><!-- /input-group --> 87 </div><!-- /.col-lg-6 --> 88 <div class="col-md-3 col-md-push-6"> 89 <a href="/add_publisher/" class="btn btn-info pull-right">添加新信息</a> 90 <button class="btn btn-success" data-target="#mymodal" data-toggle="modal">新增</button> 91 </div> 92 </div> 93 <!--数据表格--> 94 <div class="table-responsive"> 95 <table class="table table-striped table-bordered"> 96 <thead> 97 <tr> 98 <th class="text-center">序号 </th> 99 <th class="text-center">名称</th> 100 <th class="text-center">操作</th> 101 </tr> 102 </thead> 103 <tbody> 104 {% for publisher in publisher_list %} 105 <tr> 106 <td class="text-center">{{ forloop.counter }}</td> 107 <td class="text-center">{{ publisher.name }}</td> 108 <td class="text-center"> 109 <a href="/edit_publisher/?id={{ publisher.id }}" class="btn btn-primary btn-sm"><span 110 class="glyphicon glyphicon-pencil" 111 aria-hidden="true"></span>编辑 112 </a> 113 <a href="/delete_publisher/?id={{ publisher.id }}" class="btn btn-danger btn-sm"><span 114 class="glyphicon glyphicon-trash" 115 aria-hidden="true"></span>删除 116 </a> 117 </td> 118 </tr> 119 {% endfor %} 120 </tbody> 121 </table> 122 </div> 123 <!--分页按钮--> 124 <nav aria-label="Page navigation" class="pull-right"> 125 <ul class="pagination"> 126 <li> 127 <a href="#" aria-label="Previous"> 128 <span aria-hidden="true">«</span> 129 </a> 130 </li> 131 <li><a href="#">1</a></li> 132 <li><a href="#">2</a></li> 133 <li><a href="#">3</a></li> 134 <li><a href="#">4</a></li> 135 <li><a href="#">5</a></li> 136 <li> 137 <a href="#" aria-label="Next"> 138 <span aria-hidden="true">»</span> 139 </a> 140 </li> 141 </ul> 142 </nav> 143 </div> 144 </div> 145 </div> 146 </div> 147 </div> 148 </div> 149 150 <!--模态框--> 151 <div class="modal fade" tabindex="-1" role="dialog" id="mymodal"> 152 <div class="modal-dialog" role="document"> 153 <div class="modal-content"> 154 <div class="modal-header"> 155 <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 156 <span aria-hidden="true">×</span></button> 157 <h4 class="modal-title">添加新信息</h4> 158 </div> 159 <div class="modal-body"> 160 <form class="form-horizontal"> 161 <div class="form-group"> 162 <label for="inputName3" class="col-sm-3 control-label">出版社名称</label> 163 <div class="col-sm-4"> 164 <input type="email" class="form-control" id="inputName3" placeholder=""> 165 </div> 166 </div> 167 <div class="form-group"> 168 <label for="inputAddress3" class="col-sm-3 control-label">出版社地址</label> 169 <div class="col-sm-4"> 170 <input type="password" class="form-control" id="inputAddress3" placeholder=""> 171 </div> 172 </div> 173 </form> 174 </div> 175 <div class="modal-footer"> 176 <button type="button" class="btn btn-default" data-dismiss="modal">取消</button> 177 <button type="button" class="btn btn-primary">保存</button> 178 </div> 179 </div><!-- /.modal-content --> 180 </div><!-- /.modal-dialog --> 181 </div><!-- /.modal --> 182 183 <script src="../static/js/jquery-3.3.1.min.js"></script> 184 <script src="../static/bootstrap-3.3.7/js/bootstrap.min.js"></script> 185 186 </body> 187 188 </html>
出版社添加页面
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1"> 6 <title>Title</title> 7 <link rel="stylesheet" href="../static/bootstrap-3.3.7/css/bootstrap.min.css"> 8 </head> 9 <body> 10 <div class="container-fluid"> 11 <div class="row"> 12 <h1 class="text-center">添加出版社信息</h1> 13 <form class="form-horizontal" method="post" action="/add_publisher/"> 14 <div class="form-group"> 15 <label for="inputEmail3" class="col-md-2 col-md-push-3 control-label">出版社名字</label> 16 <div class="col-md-3 col-md-push-3"> 17 <input type="text" class="form-control" id="inputEmail3" name="add_name"> 18 </div> 19 </div> 20 <div class="form-group"> 21 <div class="col-md-offset-5 col-md-10"> 22 <button type="submit" class="btn btn-default">提交</button> 23 </div> 24 </div> 25 </form> 26 </div> 27 </div> 28 </body> 29 </html>
出版社编辑页面
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1"> 6 <title>Title</title> 7 <link rel="stylesheet" href="../static/bootstrap-3.3.7/css/bootstrap.min.css"> 8 </head> 9 <body> 10 <div class="container-fluid"> 11 <div class="row"> 12 <div class="page-header"> 13 <h1 class="text-center">编辑出版社 14 </h1> 15 </div> 16 <div class="panel panel-primary col-md-6 col-md-offset-3"> 17 <div class="panel-heading"> 18 <h3 class="panel-title">Panel title</h3> 19 </div> 20 <div class="panel-body"> 21 <form class="form-horizontal" method="post" action="/edit_publisher/?id={{ publisher.id }}"> 22 <div class="form-group"> 23 <label for="inputName3" class="col-md-2 col-md-push-3 control-label">出版社名字</label> 24 <div class="col-md-3 col-md-push-3"> 25 <input type="text" class="form-control" id="inputName3" name="edit_name" value="{{ publisher.name }}"> 26 </div> 27 </div> 28 <div class="form-group"> 29 <div class="col-md-offset-5 col-md-10"> 30 <button type="submit" class="btn btn-default">提交</button> 31 </div> 32 </div> 33 </form> 34 </div> 35 </div> 36 </div> 37 </div> 38 </body> 39 </html>
以上是关于项目之图书信息管理的主要内容,如果未能解决你的问题,请参考以下文章
项目实战 图书信息管理系统(Maven,mybatis)(第一个自己独立完成的项目)