开发者

expand users table with django

开发者 https://www.devze.com 2022-12-12 18:14 出处:网络
I\'m using the authentication that ships with django, and a开发者_如何学运维s such, it comes with its own SQL table. I have a few more attributes I\'d like to use with the User model that are custom t

I'm using the authentication that ships with django, and a开发者_如何学运维s such, it comes with its own SQL table. I have a few more attributes I'd like to use with the User model that are custom to my app such as a user photo or a random user blob where users can type in notes.

what's the best way of extending the existing user table that ships with django's authentication/authorization modeling to allow for my custom fields?


Please see my (and others) answer to this question:


The other way to handle this is to do table inheritance on the User model and develop your own derived EnhancedUser model. Typically a custom wrapper backend is also written to make sure the auth subsystem returns the EnhancedUser model as well.

There's a very good blog post answer here.

0

精彩评论

暂无评论...
验证码 换一张
取 消