会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
whcp
人生苦短、python是岸
博客园
管理
上一页
1
2
3
4
下一页
2020年9月21日
django测试平台开发,注册
摘要: #1-先建表--创建创建用户-角色-权限表 #注册使用md5加密,可以写入tools.py import hashlibdef md5(s): '''md5''' m = hashlib.md5(s.encode()) return m.hexdigest() ### models.py ###cl
阅读全文
posted @ 2020-09-21 11:49 whcp
阅读(199)
评论(0)
推荐(0)
2020年9月11日
django接口开发-代码优化views_post/put/delete
摘要: #优化cbc就代码其它post put delete方法,同理 class BaseView(View): from_class = None @property def form(self): #issubclass:参数1是不是参数2的子类,校验model_class if self.from_
阅读全文
posted @ 2020-09-11 15:05 whcp
阅读(387)
评论(0)
推荐(0)
django接口开发-代码优化views_get,urls
摘要: #利用cbv的继承特性,进行views中代码优化 #把views中的代码拆出来,新建custom_view.py,把cbv-class从views中挪进去 #自定义view,custom_view.py中新建一个BaseView 用于定义条件变量 import datetime from itert
阅读全文
posted @ 2020-09-11 15:04 whcp
阅读(233)
评论(0)
推荐(0)
django接口开发-代码优化中间件middlewares、自定义response
摘要: # django并没有处理PUT的数据,实际上put传过来的数据在request.body# 需要导入 from django.http import QueryDict 来处理数据put_data = QueryDict(requests.body)#所以可以用middlewares实现Query
阅读全文
posted @ 2020-09-11 15:03 whcp
阅读(351)
评论(0)
推荐(0)
diango接口开发, FBV/CBV, BaseModel , 框架优化:restfromwork
摘要: 全局参数(get,post,put,delete) #urls优化,不同app隔离 1-app下创建urls,在主urls中导入 使用include from django.urls import path,includefrom example import viewsurlpatterns =
阅读全文
posted @ 2020-09-11 08:52 whcp
阅读(188)
评论(0)
推荐(0)
2020年9月3日
django开发、filter操作、处理、多对多,django-forms,ModelForm
摘要: #前端 对后端返回数据进行处理,自带filter 后端返回:status = "很高兴见到你" , word=' nice too meet you’ 1-{{ status|length }} ==6, 长度 2-{{ word|upper }} ,大写 3-{{ tmp_html|safe }}
阅读全文
posted @ 2020-09-03 14:04 whcp
阅读(570)
评论(0)
推荐(0)
django页面分页功能 Paginator
摘要: #前端页面分页 Paginator #views逻辑 from django.core.paginator import Paginatordef index(request): page = request.GET.get('page') articles = models.Article.obj
阅读全文
posted @ 2020-09-03 13:49 whcp
阅读(357)
评论(0)
推荐(0)
django开发 Form操作
摘要: #自定义filter(过滤器) user下新建目录:templatetags,下新建:tmpTags.py from django import templateregister = template.Library@register.filterdef status_filter(x): retu
阅读全文
posted @ 2020-09-03 10:13 whcp
阅读(126)
评论(0)
推荐(0)
2020年8月24日
前端-CSS基础
摘要: CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明。 1.CSS type 属性指示 <style> 与 </style> 标签之间的内容。 值 "text/css" 指示内容是标准的 CSS。 <style type="text/css"> ... </style> 2.ID选择器 #
阅读全文
posted @ 2020-08-24 10:54 whcp
阅读(194)
评论(0)
推荐(0)
前端-HTML基础
摘要: 1.<p></p>段落标签 <p>别在最该拼搏的年纪选择稳定,世界上最大的不变是改变,只有每天进步,才能拥抱生命的无限可能!</p> 2.</b>换行 3.<h></h>标题标签 <h1><h1></h1>标题标签h1</h1> <h2><h2></h2&g
阅读全文
posted @ 2020-08-24 10:52 whcp
阅读(195)
评论(0)
推荐(0)
上一页
1
2
3
4
下一页
公告