最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

authentication - How to access an attribute from an authenticated user in Django? - Stack Overflow

programmeradmin0浏览0评论

I have a line of code that authenticates a user:

user = authenticate(request, username=username, password=password, company=company)

Is there a method that gets an attribute from the authenticated user? Let's say this is my user database table in the system:

|username|password|company|type|
|Victor| charlie| Echo| Delta|
| Bravo | Alpha | Beta | Gamma|

I am hoping to see if there was a method that would function as follows:

user.get_type()

And it returns Delta for Victor, and Gamma for Charlie.

This is the page I have been reading for the documentation:

Django authenticate documentation

发布评论

评论列表(0)

  1. 暂无评论