上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 25 下一页
摘要: ``` # 导入已封装好的函数-- 也成工具文件夹 from utils.sha2203 import * import hashlib import random import re # 封装sha256 def sha56(raw): # 实例化sha256对象 sha56 = hashlib.sha256() # 把要加密的密码,进行update操作并转成utf-8,不写默认是utf-8 s 阅读全文
posted @ 2020-02-29 15:10 Mr-刘 阅读(418) 评论(0) 推荐(0) 编辑
摘要: ```# 1. 反序列化----单表入库class Addcate(APIView): def post(self,request): # 用postman进行存入数据 data = request.data # 把定义好的反序列化拿来进行存入数据,也就是把获取的数据转成python串 cate = CateUnserializer(d... 阅读全文
posted @ 2020-02-29 14:57 Mr-刘 阅读(822) 评论(0) 推荐(0) 编辑
摘要: ``` import pymysql pymysql.install_as_MySQLdb() # 关系型数据库:mysql,sqlite,oracle,sqlserver,postgresql # 非关系型数据库:redis,memcache,mongodb ``` 阅读全文
posted @ 2020-02-29 14:55 Mr-刘 阅读(114) 评论(0) 推荐(0) 编辑
摘要: ``` # 用户统计模块 from datetime import datetime,timedelta def user_Count(request): # 1.一共有多少用户 tcount = Admins.objects.count() # 2.当月注册用户总数,条件(create_time开始时间,这个月1号到现在) start_time = datetime.strftime(datet 阅读全文
posted @ 2020-02-29 14:52 Mr-刘 阅读(109) 评论(0) 推荐(0) 编辑
摘要: ``` #店主表 class Shop(models.Model): name = models.CharField(max_length=50) passwd = models.CharField(max_length=255) class Meta: db_table = 'shop' #商品表 class Goods(models.Model): name = models.CharFiel 阅读全文
posted @ 2020-02-29 14:49 Mr-刘 阅读(626) 评论(0) 推荐(0) 编辑
摘要: ```商品名称:商品价格:商品图片:添加 methods:{ addgoods:function () { var user_id = sessionStorage.getItem('id'); this.user_id = user_id; var data = new FormDat... 阅读全文
posted @ 2020-02-29 14:46 Mr-刘 阅读(1075) 评论(0) 推荐(0) 编辑
摘要: ``` Django 模板继承 (1)、在一个完整的HTML里面写入 Document {% block head %} >继承的格式(有开始,有结束) (继承头部) 电器 日用品 可以是动态的 水果 {% endblock head %} >(结束头部继承) {% block body %} >继承的格式(有开始,有结束) (继承内容) {% endblock body %} >(结束内容继承) 阅读全文
posted @ 2020-02-29 14:36 Mr-刘 阅读(153) 评论(0) 推荐(0) 编辑
摘要: ``` 例--示范 # 电影表 class Move(models.Model): name = models.CharField(max_length=50) image_url = models.CharField(max_length=255) class Meta: db_table = 'move' def __str__(self): return self.name # 演员表 cl 阅读全文
posted @ 2020-02-29 13:36 Mr-刘 阅读(287) 评论(0) 推荐(0) 编辑
摘要: ```一、需要把captcha的文件夹,复制到本Django项目目录下,utils文件夹里from utils.captcha.captcha import captcha# 验证码----------图片class ImageView(View):def get(self,request):# text------->图片中的文本# image---------->图片name,text,ima... 阅读全文
posted @ 2020-02-29 13:35 Mr-刘 阅读(109) 评论(0) 推荐(0) 编辑
摘要: ```安装命令1. pip install djangorestframework2. from rest_framework.views import APIView 2.引入--rest_framework---->下划线,需要在配置文件夹app处的地方加入序列化的类---将python数据类型转换成josn字符串3.单写一个py文件 myserializers.py导包: from ... 阅读全文
posted @ 2020-02-29 13:33 Mr-刘 阅读(245) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 25 下一页