Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django import forms
- from registration.forms import RegistrationForm
- from django.utils.translation import ugettext_lazy as _
- from yourapp.models import SampleProfile
- from registration.models import RegistrationProfile
- attrs_dict = { 'class': 'required' }
- class RegistrationFormZ(RegistrationForm):
- middle_name = forms.CharField(widget=forms.TextInput(attrs=attrs_dict))
- def save(self, profile_callback=None):
- new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'],
- password=self.cleaned_data['password1'],
- email=self.cleaned_data['email'])
- new_profile = SampleProfile(user=new_user, user_middle_name=self.cleaned_data['middle_name'])
- new_profile.save()
- return new_user
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement