【问题标题】:how to get the email address from auth_user table of requested user id in django 1.5?如何从 django 1.5 中请求的用户 ID 的 auth_user 表中获取电子邮件地址?
【发布时间】:2013-12-22 10:32:00
【问题描述】:

我尝试了以下行

appraiser_email = auth_user.objects.get(id__exact=2)

当我在上面执行时,它在说

global name 'auth_user' is not defined

我想在models.py中定义一个模型auth_user还是有其他方法?

提前致谢

【问题讨论】:

    标签: django django-models django-views


    【解决方案1】:
    from django.contrib.auth.models import User
    
    user = User.objects.get(id=2)
    user_email = user.email
    

    【讨论】:

      猜你喜欢
      • 2017-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-01
      • 1970-01-01
      • 2020-10-31
      • 2013-08-16
      相关资源
      最近更新 更多