Note that there are some explanatory texts on larger screens.

plurals
  1. POAdditional fields in django not being saved
    primarykey
    data
    text
    <p>I have already looked through all the django registration examples and i've successfully created a form with extended fields but i've experienced a few problems listed below, mainly with the data not being saved in the DB table UserProfile.</p> <p>I created a forms.py and stored in my proj directory.</p> <p>It's as follows: </p> <pre><code>from django import forms from r2.models import Keyword from r2.models import UserProfile from registration.forms import RegistrationForm from registration.models import RegistrationProfile from django.utils.translation import ugettext_lazy as _ from registration.forms import RegistrationForm, attrs_dict class ProjectSpecificRegistrationForm(RegistrationForm): keywords = forms.ModelChoiceField(queryset=Keyword.objects.all()) first_name =forms.CharField(widget=forms.TextInput(attrs=attrs_dict),label=_(u'First Name')) last_name =forms.CharField(widget=forms.TextInput(attrs=attrs_dict),label=_(u'Last Name')) 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 = UserProfile(user=new_user,username=self.cleaned_data['username'], keywords_subscribed=self.cleaned_data['keywords'],first_name=self.cleaned_data['first_name'],last_name=self.cleaned_data['last_name']) new_profile.save() </code></pre> <p>and the <strong>URLS.py:</strong></p> <pre><code>#registrations URLS url(r'^activate/(?P&lt;activation_key&gt;\w+)/$',activate,name='registration_activate'), url(r'^login/$',auth_views.login,{'template_name': 'registration/login.html'}, name='auth_login'), url(r'^logout/$',auth_views.logout,{'template_name': 'registration/logout.html'},name='auth_logout'), url(r'^password/change/$',auth_views.password_change,name='auth_password_change'), url(r'^password/change/done/$',auth_views.password_change_done,name='auth_password_change_done'), url(r'^password/reset/$',auth_views.password_reset,name='auth_password_reset'), url(r'^password/reset/confirm/(?P&lt;uidb36&gt;[0-9A-Za-z]+)-(?P&lt;token&gt;.+)/$',auth_views.password_reset_confirm,name='auth_password_reset_confirm'), url(r'^password/reset/complete/$',auth_views.password_reset_complete,name='auth_password_reset_complete'), url(r'^password/reset/done/$',auth_views.password_reset_done,name='auth_password_reset_done'), url(r'^register/$',register, {'backend': 'accounts.regbackend.RegBackend','form_class' : ProjectSpecificRegistrationForm}, name='registration_register'), url(r'^register/complete/$',direct_to_template,{'template': 'registration/registration_complete.html'},name='registration_complete'), </code></pre> <p>I've added all these to the proj urls.py as i've followed a tutorial from somewhere. </p> <p><strong>Problem 1: User profile is not getting saved into the DB even though i am using django registration 0.6.</strong> </p> <p><strong>Problem 2: Is this the correct way to set my urls.py? because i understand i'm not supposed to overwrite the registration urls.py.</strong></p> <p><strong>Problem 3: Must i create a regbackend.py? and if so how do i go about doing that?</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload