django.core.exceptions.ImproperlyConfigured:创建没有 'fields' 属性或 'exclude' 属性的 ModelForm 是 prohibited.need

django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited.need

我遇到错误,无法使用字段或 exculde 属性创建表单,请帮助我解决此错误 来自 forms.py 的代码是:

from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User


class CustomerRegistrationForm(UserCreationForm):
    password1 = forms.CharField(label='Password', widget=forms.PasswordInput(attrs= 
    {'class':'form-control'}))
    password2 = forms.CharField(label='Confirm Password (again)', 
    widget=forms.PasswordInput(attrs={'class':'form-control'}))
    email = forms.CharField(required=True, widget=forms.EmailInput(attrs={'class':'form- 
    control'}))

    class Meta:
        model = User
        fiedls = ['email', 'username', 'password1', 'password2']
        labels = {'email': 'Email'}
        widgets = {'username':forms.TextInput(attrs={'class':'form-control'})} 

你在 fiedls 上打错了,应该是 fields