擅长:python、mysql、java
<p>用户没有后端,因此必须使用用户管理器(如果有自定义用户类,则使用BaseUserManager)</p>
<pre><code>BaseUserManager.get_by_natural_key(username)
</code></pre>
<p><a href="https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#django.contrib.auth.models.BaseUserManager" rel="nofollow">https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#django.contrib.auth.models.BaseUserManager</a></p>