社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  问与答

django auth库user 和 permission类的继承

叉叉 • 10 年前 • 5531 次点击  

django auth库user 和 permission类如何继承呢,我需要扩展一下这两个类,增加自己的一些字段

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/581
 
5531 次点击  
文章 [ 3 ]  |  最新文章 10 年前
Py站长
Reply   •   1 楼
Py站长    10 年前

本社区比较早,是采用Profile方式的,推荐楼上的方法

爱情的枪
Reply   •   2 楼
爱情的枪    10 年前

http://www.roguelynn.com/words/django-custom-user-models/

爱情的枪
Reply   •   3 楼
爱情的枪    10 年前

The easiest way to construct a compliant custom User model is to inherit from AbstractBaseUser. AbstractBaseUser provides the core implementation of a User model, including hashed passwords and tokenized password resets. You must then provide some key implementation details:

可以继承AbstractBaseUser来做哦~~

https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.contrib.auth.models.AbstractBaseUser