I was able to get the noRecaptcha form on my Django-allauth signup form, with the template using crispy forms. Using this answer
The question is really about forcing a field order on the crispy form layout, when the form is contained in django-allauth and does not specify a layout (per the author). So when overriding the signup form with a custom form of my own, I've tried to specify a layout, but am not sure I'm getting it recognized.
Combining other posts' answers:
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
I'm sure I have the wrong model referenced or it's simply ignored. The noRecaptcha field just sits happily at the top of the form, instead of at the bottom where I'd like it.
I've also tried using FormHelper - but must clearly be doing it wrong.
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'))
I'd rather not rewrite the template, and hope there is a way to override the layout.