上一页 1 2 3 4 5 6 7 ··· 12 下一页
摘要: 用户认证 auth模块 一、auth模块 from django.contrib import auth 1 、authenticate()   :验证用户输入的用户名和密码是否相同 提供了用户认证,即验证用户名以及密码是否正确,一般需要username  password两个关 阅读全文
posted @ 2019-10-04 10:10 呵!小鹿 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 分页和中间件 一、分页 Django的分页器(paginator) view.py from django.shortcuts import render,HttpResponse Create your views here. from app01.models import from djang 阅读全文
posted @ 2019-10-04 10:09 呵!小鹿 阅读(183) 评论(0) 推荐(0) 编辑
摘要: django 之知识点总结以及Form组件 一、model常用操作 1、13个API查询:all,filter,get ,values,values_list,distinct,order_by ,reverse , exclude(排除),count,first,last,esits(判断是否存在 阅读全文
posted @ 2019-10-04 10:08 呵!小鹿 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 今天学到的新知识 一、定义的规则 class TeacherForm(Form): 必须继承Form 创建字段,本质上是正则表达式 username = fields.CharField( required=True, 必填字段 error_messages={"required":"用户名不能为空 阅读全文
posted @ 2019-10-04 10:07 呵!小鹿 阅读(216) 评论(0) 推荐(0) 编辑
摘要: Form组件归类 一、Form类 创建Form类时,主要涉及到 【字段】 和 【插件】,字段用于对用户请求数据的验证,插件用于自动生成HTML; 1、Django内置字段如下: 1 Field 2 required=True, 是否允许为空 3 widget=None, HTML插件 4 label 阅读全文
posted @ 2019-10-04 10:06 呵!小鹿 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 自定义验证规则以及中间件简单介绍 1、python2和python3中的区别 对于python2内置的字符串类型有str和unicode 比如:"abc"是字符串,u"你好"是unicode 字符串(utf 8/gbk编码之后值) unicode 对于python3内置的字符串类型有bytes和un 阅读全文
posted @ 2019-10-04 10:05 呵!小鹿 阅读(278) 评论(0) 推荐(0) 编辑
摘要: x学生管理系统(用中间件) 基于FORM组件 目的:实现学生,老师,课程的增删改查 models.py   from django.db import models Create your models here. class UserInfo(models.Model): """ 用户表 阅读全文
posted @ 2019-10-04 10:04 呵!小鹿 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 图书管理系统(无中间件,用装饰器的) 未基于FORM组件 目的:实现图书的增删改查 models.py   from django.db import models Create your models here. class Book(models.Model): nid = model 阅读全文
posted @ 2019-10-04 10:03 呵!小鹿 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 前期知识点回顾 内容回顾1、可迭代对象、迭代器、生成器、装饰器有什么区别? 可迭代对象:内部实现了__iter__方法,是一个迭代器 迭代器:内部实现了__iter__和__next__方法,可以进行for循环 生成器:函数内部有yield的就是生成器,生成器也有一个__next__方法,它的本质是 阅读全文
posted @ 2019-10-04 10:02 呵!小鹿 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 自己没有记住的一点小知识(ORM查询相关) 一、多对多的正反向查询 class Class(models.Model): name = models.CharField(max_length=32,verbose_name="班级名") course = models.CharField(verbo 阅读全文
posted @ 2019-10-04 10:01 呵!小鹿 阅读(118) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 12 下一页