Domanda

Attualmente sto usando Django-Registration V0.8A e Django-Recaptcha per la mia parte di registrazione. Tutto funziona bene con il campo Recaptcha che si presenta, tranne per il fatto che non sono in grado di far funzionare la RegistrationFormUniqueEmail. Ecco alcuni dei dettagli.

Ho assicurato che il mio captcha forms.py sia effettivamente sottoclasse dalla forma corretta:

from registration.forms import RegistrationFormUniqueEmail

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

Ho anche inserito il tasto Form_Class in tutti gli URL associati alla vista del registro che gestisce la chiamata, ad esempio:

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

Uno strano comportamento che ho notato è che quando provo a cambiare le etichette sulle mie forme, i cambiamenti non si stanno riflettendo. Forse questo fa parte dello stesso problema che avrei potuto trascurare qualcosa?

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)"))

cioè cambio una delle etichette in un'altra frase, non dovrebbe essere riflesso?

Grazie per la visione!

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top