[py][mx]operation模型设计】的更多相关文章

用户表 UserMesasage 用户消息 UserFavorite 用户收藏 UserAsk 用户咨询 UserCourse 用户学习的课程 CourseComments 用户评论 收藏有3种类型 代码 from django.db import models from datetime import datetime from users.models import UserProfile from courses.models import Course # Create your mod…
分析下城市-教学机构-教师模型设计 CourseOrg 课程信息 Teacher 教师信息 CityDict 城市信息 代码 from datetime import datetime from django.db import models # Create your models here. class CityDict(models.Model): name = models.CharField(max_length=20, verbose_name="城市") desc = m…
项目开端 参考的是mxonline项目 先把这两项完成 1.app设计 2.app的models的设计 经过分析系统有四个模块 users - 用户管理 course - 课程管理 oranization - 授课教师&授课机构 operation - 用户操作管理 一般系统都先设计用户模块, 把较为独立的模块也放在users模块 先设计user模块 - 用户详情里的字段有 image nick_name gender brith mobile address django默认自带用户表的字段无…
首先createsuperuser,创建用户, 然后登陆xadmin. 理解下models的各个字段 复数形式及返回 注册app users/adminx.py 显示字段 users/adminx.py 注: 这里显示的顺序和列表顺序是一致的. 搜索字段(手动输入关键字搜索)search_fileds users/adminx.py 一般不搜索时间,不好搜索. 这里看到还可以将数据导出各种格式. 到此为止,我们每个表的增删改查功能就齐全了. 过滤器list_filter(自动点选搜索), 可以通…
xadmin配置 - 安装 pip install -r https://github.com/sshwsfc/xadmin/blob/django2/requirements.txt 以下被我测试通过 pip install -i https://pypi.douban.com/simple django>=2 pip install -i https://pypi.douban.com/simple django-crispy-forms>=1.6.0 pip install -i htt…
浏览器同源策略(same-origin policy) csrf攻击防御核心点总结 django的cookie和session操作-7天免登录 flask操作cookie&django的seesion和cookie机制 处理登录逻辑 users/views.py from django.contrib.auth import authenticate, login def user_login(request): if request.method == "POST": use…
浏览器同源策略(same-origin policy) csrf攻击防御核心点总结 django的cookie和session操作-7天免登录 flask操作cookie&django的seesion和cookie机制 cookie操作参考: http://www.cnblogs.com/lhj588/archive/2011/10/27/2226976.html 这玩意可以实现7天免登录等功能. session和cookie机制原理和交互过程 交互过程 ① 客户端访问,无服务端写入的Cooki…
创建自定义验证用户名密码类CustomBackend users/views.py from django.contrib.auth import authenticate, login from django.contrib.auth.backends import ModelBackend from django.shortcuts import render # Create your views here. from users.models import UserProfile cla…
前台的这些数据都是从后台取来的 分页模块django-pure-pagination - 一款基于django pagination封装的更好用的分页模块 https://github.com/jamespacileo/django-pure-pagination - 安装 pip install django-pure-pagination views.py from pure_pagination import Paginator, EmptyPage, PageNotAnInteger c…
city和课程机构信息展示到前台去 organization/views.py from django.views.generic.base import View from organization.models import CourseOrg, CityDict class OrgView(View): # 课程机构列表页 def get(self, request): all_orgs = CourseOrg.objects.all() all_citys = CityDict.obje…