当前位置:网站首页>DRF--users用户模块
DRF--users用户模块
2022-07-21 12:39:00 【chuntian_tester】
当Django自带的User模型类不满足需求时可以自定义User模型
1. 创建users子应用
python manage.py startapp users
2. 注册users子应用
3. 定义users模型类
3.1 继承django的user模型
from django.contrib.auth.models import User
3.2 定义User模型中不具备但是自己需要的字段
3.3 在全局配置文件中指定使用自定义的UserModel模型类,而不再适用django自带的auth.User模型类
3.3.1 若未自定义,会使用django自带的auth.User模型类
3.3.2 配置文件中设置自定义的UserModel
AUTH_USER_MODEL = 'users.models.UserModel'
边栏推荐
- 马斯克热搜体质无疑,称已将大脑上传云端,却遭网友热议!
- 归并排序解决逆序对的数量问题
- Hcip notes sorting 2022/7/15
- When the neural network model is not as good as the decision tree
- Verification of implicit conversion rules for different types of arithmetic operations in C language
- 第十一节 缓存雪崩、热点数据失效 跟着大宇学Redis--------目录帖
- Implementation of SPU module and SKU module of shangpinhui background management project
- 阿里云ECS手动挂载磁盘
- es6 循环 过滤 取值
- Understand the volatile implementation of JVM from the bottom, CPU cache, cache consistency MESI, store bufferi, nvalidate queue and other knowledge
猜你喜欢
随机推荐
ICML2022最佳论文奖:从数百万个预测结构中学习蛋白质逆折叠
4K投影仪为什么比1080P投影仪更值得买?答案显而易见!
Deeply understand the timeout setting of istio traffic management
写页面注意的问题
05mysql的锁分析
A concise tutorial for soft exam system architecture designers | software development model
window10任务栏操作
Implementation of SPU module and SKU module of shangpinhui background management project
Nested cross validation
Musk's hot search physique undoubtedly said that he had uploaded his brain to the cloud, but it was hotly discussed by netizens!
【苏州大学】考研初试复试资料分享
七月集训(第21天) —— 堆(优先队列)
巴比特 | 元宇宙每日必读:要求高级政府官员披露其在NFT上的所有投资?美国政府道德办公室发布的这份法律咨询还说了什么?...
Medical cell image segmentation
有点酷,使用 .NET MAUI 探索太空
从0写bootloader — Bootloader重定位APP
vscode添加include库
软考 系统架构设计师 简明教程 | 软件开发模型
MySQL view stored procedures and functions
Design message queue MySQL table to store message data