python - django-allauth Custom Sociallogin Signup Form with keyOrder -
Using Django 1.7 and how to change the key order, but the problem is that password 1 and password 2 in social_login If not, then this will not work:
class SignupForm (forms.Form): def __init __ (auto, * args, ** kwargs): Super (SignupForm, itself) .__ init __ (* args, 'Kwargs') fields_keyOrder = ['username', 'email', 'age', 'sex', 'password1', 'password2', 'captcha'] if (self.fields.has_key ('KeyOrder')): Self.fields.keyOrder = fields_keyOrder else: self.fields = ordainedDict (fields_key order) For, self.fields [k]) I tried to create another form for Sociallogins that do not have password 1 in key order, but try to reach the form There is an error while doing:
class SocialSignupForm (forms.Form): def __init __ (self, * args, ** kwargs): super (social size, self) .__ init __ ( Field_key order = ['user name', 'email', 'age', 'gender'] if (self.fields.has_key ('keyOrder')): self.fields.keyOrder = fields_keyOrder else: Self.fields = ordainedDict ((in k, Fields_keyOrder K The keyword logic 'sociallogin'
I'm working on it Second signup form is not required, So remove it from settings.py: SOCIALACCOUNT_FORMS = {'signup': 'yourapp.forms.SocialSignupForm'} (Self, 'sosalolin') class signupform (forms.Form): def __init __ (self, * args, * (self, 'sociallogin') : Fields_keyOrder = ['User Field_key order = ['username', 'email', 'listen_directory', 'age', 'sex', 'password 1' and 'password' ',' Password2 ',' captcha '] if (self.fields.has_key (' keyOrder ')): self Field Keyoder = field_cadder Other: self.fields = ordered orders (for fields of [k], fields_keyOrder k)
Comments
Post a Comment