Py学习  »  问与答

django auth库user 和 permission类的继承

叉叉 • 10 年前 • 5610 次点击  

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

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/581
 
5610 次点击  
文章 [ 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