سؤال

I am currently using django-registration v0.8a and django-recaptcha for my registration portion. Everything is working fine with the recaptcha field showing up except that I am unable to get the RegistrationFormUniqueEmail to work. Here are some of the details.

I have ensured that my captcha\forms.py is indeed subclassing from the correct form:

from registration.forms import RegistrationFormUniqueEmail

class RegistrationFormCaptcha(RegistrationFormUniqueEmail):
captcha = ReCaptchaField(attrs={'theme': 'white'})

I have also placed the form_class key in all the urls associated with the register view which handles the call, for instance:

url(r'^register/$',
          register,
          { 'form_class': RegistrationFormUniqueEmail,
                'backend': 'registration.backends.default.DefaultBackend' },
          name='registration_register'),

One strange behaviour I have noticed is that when I attempt to change the labels on my forms, the changes are not being reflected. Perhaps this is part of the same problem as I might have overlooked something?

class RegistrationForm(forms.Form):
"""
Form for registering a new user account.

Validates that the requested username is not already in use, and
requires the password to be entered twice to catch typos.

Subclasses should feel free to add any additional validation they
need, but should avoid defining a ``save()`` method -- the actual
saving of collected user data is delegated to the active
registration backend.

"""
username = forms.RegexField(regex=r'^\w+$',
                            max_length=30,
                            widget=forms.TextInput(attrs=attrs_dict),
                            label=_("Username"),
                            error_messages={ 'invalid': _("This value must contain only letters, numbers and underscores.") })
email = forms.EmailField(widget=forms.TextInput(attrs=dict(attrs_dict,
                                                           maxlength=75)),
                         label=_("Email address"))
password1 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict, render_value=False),
                            label=_("Password"))
password2 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict, render_value=False),
                            label=_("Password (again)"))

i.e I change one of the labels to another phrase, shouldn't that be reflected?

Thanks for viewing!

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top