擅长:python、mysql、java
<p>您可以使用一个名为<a href="https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.models.User.get_profile" rel="nofollow">get_profile()</a>的特殊方法</p>
<pre><code>profile_for_user = user.get_profile()
</code></pre>
<p>需要提醒的是,您必须在设置.py你知道吗</p>
<p>但是,django1.5中不赞成这种方法,因为它添加了对<a href="https://docs.djangoproject.com/en/dev/topics/auth/#auth-custom-user" rel="nofollow">user model customization</a>的支持</p>