fix: Correctly use custom user model in registration form
This commit is contained in:
parent
0d22ea0b65
commit
1a2878330e
@ -1,5 +1,5 @@
|
||||
from django import forms
|
||||
from .models import AdoptionNotice, Animal, Image, Report, ModerationAction
|
||||
from .models import AdoptionNotice, Animal, Image, Report, ModerationAction, User
|
||||
from django_registration.forms import RegistrationForm
|
||||
|
||||
|
||||
@ -45,4 +45,5 @@ class ModerationActionForm(forms.ModelForm):
|
||||
|
||||
|
||||
class CustomRegistrationForm(RegistrationForm):
|
||||
pass
|
||||
class Meta(RegistrationForm.Meta):
|
||||
model = User
|
||||
|
@ -1,4 +1,7 @@
|
||||
from django.urls import path, include
|
||||
from django_registration.backends.activation.views import RegistrationView
|
||||
|
||||
from .forms import CustomRegistrationForm
|
||||
|
||||
from . import views
|
||||
|
||||
@ -35,6 +38,12 @@ urlpatterns = [
|
||||
# ex: user/1
|
||||
path("user/<int:user_id>/", views.member_detail, name="user-detail"),
|
||||
|
||||
path('accounts/register/',
|
||||
RegistrationView.as_view(
|
||||
form_class=CustomRegistrationForm
|
||||
),
|
||||
name='django_registration_register',
|
||||
),
|
||||
path('accounts/', include('django_registration.backends.activation.urls')),
|
||||
path('accounts/', include('django.contrib.auth.urls')),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user