Django Registration Redux: Add Fields To User Profile error -
i trying add extended fields user, save user info not field in new table.
this model:
class userprofile(models.model): field = models.charfield(max_length=3) user = models.onetoonefield(user, unique=true)
here form:
class userprofileregistrationform(registrationformuniqueemail): field = forms.charfield()
regbackend.py
class userregistrationview(registrationview): form_class = userprofileregistrationform def register(self, request, form_class): new_user = super(userregistrationview, self).register(request, form_class) new_user.field = form_class.cleaned_data['field'] new_user.save() user_profile = new_user.get_profile() user_profile.field = form_class.cleaned_data['field'] user_profile.save() return user_profile
and urls.py
urlpatterns = patterns('', url(r'^$', index_view), url(r'^accounts/register/$', regbackend.userregistrationview.as_view(), name='registration_register'), url(r'^accounts/', include('registration.backends.default.urls')), )
any idea issue be?
Comments
Post a Comment