crisp 양식을 사용하여 템플릿을 사용하여 Django-allauth 가입 양식에 noRecaptcha 양식을 가져올 수있었습니다. Using this answerDjango Reoder norecaptcha nautocaptcha allauth 가입 필드에 바삭한 양식 사용
질문은 양식이 django-allauth에 포함되어 있고 작성자별로 레이아웃을 지정하지 않은 경우 파삭 파삭 한 양식 레이아웃에서 필드 순서를 강제하는 것과 관련이 있습니다. 따라서 사용자 정의 양식을 사용하여 가입 양식을 재정의 할 때 레이아웃을 지정하려고 시도했지만 확실하게 알 수는 없습니다.
결합 다른 게시물 '답변 :
from django import forms
from neatf.users.models import User
from nocaptcha_recaptcha.fields import NoReCaptchaField
class AllauthSignupForm(forms.Form):
captcha = NoReCaptchaField()
class Meta:
model = User
fields = ['username', 'email', 'password1', 'password2', 'captcha']
field_order = ['username', 'email', 'password1', 'password2',
'captcha']
def signup(self, request, user):
""" Required, or else it throws deprecation warnings """
pass
내가 잘못된 모델을 참조하거나 단순히 무시됩니다 있습니다 확신합니다. noRecaptcha 필드는 양식의 맨 위 부분에서 기쁜 마음으로 앉을 수 있습니다.
FormHelper를 사용해 보았지만 명확하게 잘못하고 있어야합니다.
helper = FormHelper()
helper.form_class = '.form-inline'
helper.field_template = 'bootstrap4/layout/inline_field.html'
helper.layout = Layout(
Fieldset('Contact data', 'username', 'email',),
Fieldset('Password', 'password1', 'password2', 'captcha'))
나는 템플릿을 다시 작성하지 않고 레이아웃을 재정의 할 수있는 방법이 있기를 바랍니다.
나는 django-allauth (0.31.0)을 가지고 있고 코드를 사용하여 recaptcha를 전자 메일 (순서를 표시 : username, email, recaptcha, password1, password2) 다음에 중간으로 옮길 수 있습니다. 개선되었지만 captcha를 끝까지 강요하는 방법을 모릅니다. 감사 – wedward