맞춤 서명보기를 작성하는 이유는 django- allauth SignupView의 form_valid()를 덮어 쓰고 위와 같이하는 것입니다.django-allauth를 오버 라이딩 할 수 있도록 설정 UserSignupView
컨트롤 버튼이 클릭 버튼을 클릭했을 때 CustomSignupView에 들어 가지 않고 대신 allauth UserSignup보기의 form_valid()로 가서 실행 중입니다. CustomSignUpView에 액세스하는 방법을 알려주십시오. 이 내 구현
views.py입니다 :
from allauth.account.views import LoginView, SignupView
from allauth.account.forms import SignupForm
from .forms import CustomLoginForm
from .notify import Notification
class CustomSignupView(SignupView):
notify = Notification()
def __init__(self, **kwargs):
super(CustomSignupView, self).__init__(*kwargs)
self.form_class = SignupForm
def send_email(self, form): # custom implementation
self.notify.notify(self.entity_type, form.cleaned_data)
def form_valid(self, form):
self.send_email(form)
return super(CustomSignupView, self).form_valid(form)
이 장고의 구현 :
class SignupView(RedirectAuthenticatedUserMixin, CloseableSignupMixin,
FormView):
template_name = "account/signup.html"
form_class = SignupForm
redirect_field_name = "next"
success_url = None
def get_success_url(self):
# Explicitly passed ?next= URL takes precedence
ret = (get_next_redirect_url(self.request,
self.redirect_field_name)
or self.success_url)
return ret
def form_valid(self, form):
import pdb; pdb.set_trace()
user = form.save(self.request)
return complete_signup(self.request, user,
app_settings.EMAIL_VERIFICATION,
self.get_success_url())
무엇이 당신의 질문은 무엇입니까? – CrazyCasta
새로운 사용자가 우리 웹 사이트에 가입했다는 것을 전자 메일로 form_valid의 관리자에게 보내려합니다. allauth 뷰를 오버 라이딩합니다. –
네,하지만 질문은 무엇입니까? 문제가 있습니까? – CrazyCasta