摘要: 后端传入json数据,json.dumps(data,cls=JSON.encoder) Python标准库中的json模块,集成了将数据序列化处理的功能;在使用json.dumps()方法序列化数据时候,如果目标数据中存在datetime数据类型,执行操作时, 会抛出异常:TypeError: d 阅读全文
posted @ 2018-10-11 17:19 oneforall97 阅读(38) 评论(0) 推荐(0) 编辑
摘要: ajax: 后台处理业务返回JsonResponse if request.method == 'GET': result=models.Project.objects.all() return render(request, 'project/project-list.html',{'result 阅读全文
posted @ 2018-09-27 13:27 oneforall97 阅读(22) 评论(0) 推荐(0) 编辑
摘要: linux下创建virtualenv时指定python版本 virtualenv是python开发中一个重要的工具,它可以帮助我们创建一个干净的python解释环境,创建虚拟环境时,这个虚拟环境的 python版本往往是系统默认的2.x版本.别急,我们只需要一条简单的命令就可以创建一个python3 阅读全文
posted @ 2018-09-18 15:31 oneforall97 阅读(22) 评论(0) 推荐(0) 编辑
摘要: SQL标准中有TRUNCATE TABLE语句,用来清空表的所有内容。但SQLite不支持这个语句。在SQLite中直接使用“DELETE FROM TableName”就可以了。对于大多数DBMS来说,用DELETE不如用TRUNCATE 速度快,因为TRUNCATE 不用访问整个表,不用记录数据 阅读全文
posted @ 2018-09-14 16:20 oneforall97 阅读(250) 评论(0) 推荐(0) 编辑
摘要: from django.utils.safestring import mark_safe #mark_safe可以使str标签变成HTML标签 class Paginstion(object): def __init__(self,current_page,data_count,per_page_ 阅读全文
posted @ 2018-08-31 14:00 oneforall97 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 路径导航直接使用组定义 url(r'^video-(?P<f_classification_id>(\d+))-(?P<f_level_id>(\d+))-(?P<status>(\d+)).html$', views.video), url(r'^videoSecond-(?P<direction 阅读全文
posted @ 2018-08-28 10:38 oneforall97 阅读(30) 评论(0) 推荐(0) 编辑