附加到 django UserCreationForm() 的模型是什么
What is the model attached to django UserCreationForm()
我已阅读 UserCreationForm() 的官方文档。我正在尝试访问我在其他模型中创建的用户。我调用什么模型来访问我在 UserCreationForm() 中创建的用户?简而言之,它们是我可以调用以访问用户模型的默认身份验证模型吗?
What model do I call to access the users I created within the UserCreationForm()
?
正如我们在 source code [GitHub] 中看到的,它使用 User
模型:
from django.contrib.auth.models import <b>User</b>
# …
class UserCreationForm(forms.ModelForm):
# …
class Meta:
<b>model = User</b>
fields = ("username",)
field_classes = {'username': UsernameField}
# …
因此您可以导入此模型:
from django.contrib.auth.models import <b>User</b>
documentation on the User
指定在此模型上定义的字段和方法。
我已阅读 UserCreationForm() 的官方文档。我正在尝试访问我在其他模型中创建的用户。我调用什么模型来访问我在 UserCreationForm() 中创建的用户?简而言之,它们是我可以调用以访问用户模型的默认身份验证模型吗?
What model do I call to access the users I created within the
UserCreationForm()
?
正如我们在 source code [GitHub] 中看到的,它使用 User
模型:
from django.contrib.auth.models import <b>User</b> # … class UserCreationForm(forms.ModelForm): # … class Meta: <b>model = User</b> fields = ("username",) field_classes = {'username': UsernameField} # …
因此您可以导入此模型:
from django.contrib.auth.models import <b>User</b>
documentation on the User
指定在此模型上定义的字段和方法。