摘要: 控制器中:ViewBag.Copyright = ""版权所有:&copy;&nbsp;<a href='http://www.hnjoy.com' target='_blank'> 长沙杰一信息技术有限公司</a>"; 在前台页面:<div>@ViewBag.Copyright </div> 前台 阅读全文
posted @ 2021-02-23 10:25 肖萝卜 阅读(149) 评论(0) 推荐(0)
摘要: django从view向template传递HTML字符串的时候,django默认不渲染此HTML,原因是为了防止这段字符串里面有恶意攻击的代码。 如果需要渲染这段字符串,需要在view里这样写: from django.utils.safestring import mark_safe 函数里面这 阅读全文
posted @ 2020-10-16 13:37 肖萝卜 阅读(304) 评论(0) 推荐(0)
摘要: DjangoORM字段参数介绍 字段的参数: null: ->db是否可以为空 default: ->默认值 primary_key: ->主键 db_column ->列名 db_index ->索引 unique ->唯一索引 unique_for_date ->只对时间做索引 unique_f 阅读全文
posted @ 2020-10-15 14:46 肖萝卜 阅读(65) 评论(0) 推荐(0)
摘要: 数字、字符串、列表、元组、字典 数字 Python Number 数据类型用于存储数值。 Python Number 数据类型用于存储数值,包括整型、长整型、浮点型、复数。 (1)Python math 模块:Python 中数学运算常用的函数基本都在 math 模块 import math pri 阅读全文
posted @ 2020-10-15 09:47 肖萝卜 阅读(194) 评论(0) 推荐(0)
摘要: import time localtime = time.localtime(time.time()) print "本地时间为 :", localtime 格式化日期 我们可以使用 time 模块的 strftime 方法来格式化日期: import time # 格式化成2016-03-20 1 阅读全文
posted @ 2020-10-12 14:53 肖萝卜 阅读(45) 评论(0) 推荐(0)