АБСТРАКТНЫЙ ПОЛЬЗОВАТЕЛЬ В DJANGO ALL AUTH

Я использую абстрактного пользователя в своей регистрации, используя плагин all auth вместо contrib auth.

Вот мой код в файле forms.py:

class CustomSignupForm(UserCreationForm):
first_name = forms.CharField(max_length=30, label='First Name', widget=forms.TextInput(attrs={'placeholder': 'First Name','required':'required'}))
last_name = forms.CharField(max_length=30, label='Last Name', widget=forms.TextInput(attrs={'placeholder': 'Last Name','required':'required'}))
email = forms.EmailField(max_length=40, label='Email Address', widget=forms.TextInput(attrs={'placeholder':'Email Address','required':'required'}))

class Meta:
    model = Registrations
    fields = ['first_name', 'last_name','email', 'user_type']

В моем models.py:

class Registrations(AbstractUser):
usertype =[
('Student', 'Student'),
('Staff', 'Staff')
]
user_type = models.CharField(max_length=10,choices=usertype, blank=True, null=True)

А вот settings.py для моей регистрации:

ACCOUNT_FORMS = {'signup': 'libraryApp.forms.CustomSignupForm',}
AUTH_USER_MODEL = 'libraryApp.Registrations'

Меня очень беспокоит, правильно ли я сделал, используя абстрактного пользователя в Django All Auth, потому что я не видел руководства по использованию абстрактного пользователя в All Auth.

Вернуться на верх