200 self.fields['role'] = role_field |
200 self.fields['role'] = role_field |
201 |
201 |
202 class UserProfileForm(ModelForm): |
202 class UserProfileForm(ModelForm): |
203 class Meta: |
203 class Meta: |
204 model = UserProfile |
204 model = UserProfile |
205 fields = ('allow_contact', 'preferred_language', 'is_suspended', 'tags') |
205 fields = ('allow_contact', 'is_suspended', 'tags') |
206 |
206 |
207 class MyUserProfileForm(ModelForm): |
207 class MyUserProfileForm(ModelForm): |
208 class Meta: |
208 class Meta: |
209 model = UserProfile |
209 model = UserProfile |
210 fields = ('allow_contact', 'preferred_language', 'tags') |
210 fields = ('allow_contact', 'tags') |
211 |
211 |
212 class UserProfileAddForm(ModelForm): |
212 class UserProfileAddForm(ModelForm): |
213 class Meta: |
213 class Meta: |
214 model = UserProfile |
214 model = UserProfile |
215 fields = ('preferred_language', 'tags') |
215 fields = ('tags',) |
216 |
216 |
217 class UserProfileRegisterForm(ModelForm): |
217 class UserProfileRegisterForm(ModelForm): |
218 class Meta: |
218 class Meta: |
219 model = UserProfile |
219 model = UserProfile |
220 fields = ('preferred_language', ) |
|
221 |
220 |
222 class UserAddForm(forms.Form): |
221 class UserAddForm(forms.Form): |
223 note = forms.CharField(label=ugettext_lazy(u'Note'), |
222 note = forms.CharField(label=ugettext_lazy(u'Note'), |
224 help_text=ugettext_lazy(u'Optional text to add to invitation email'), |
223 help_text=ugettext_lazy(u'Optional text to add to invitation email'), |
225 widget=forms.Textarea, |
224 widget=forms.Textarea, |
263 else: |
262 else: |
264 return HttpResponseRedirect(reverse('user')) |
263 return HttpResponseRedirect(reverse('user')) |
265 else: |
264 else: |
266 userform = UserForm() if not mass else MassUserForm() |
265 userform = UserForm() if not mass else MassUserForm() |
267 userroleform = UserRoleForm() if not(key) else None |
266 userroleform = UserRoleForm() if not(key) else None |
268 userprofileform = UserProfileAddForm({'preferred_language' : request.LANGUAGE_CODE}) |
267 userprofileform = UserProfileAddForm() |
269 noteform = UserAddForm() |
268 noteform = UserAddForm() |
270 localroleform = UserRoleTextForm(prefix="local") if key else None |
269 localroleform = UserRoleTextForm(prefix="local") if key else None |
271 |
270 |
272 if key: |
271 if key: |
273 template = 'site/user_mass_add_text.html' if mass else 'site/user_add_text.html' |
272 template = 'site/user_mass_add_text.html' if mass else 'site/user_add_text.html' |
593 profile.send_activation_email() |
592 profile.send_activation_email() |
594 display_message(request, _(u"You've been registered, please check your email for the confirm message.")) |
593 display_message(request, _(u"You've been registered, please check your email for the confirm message.")) |
595 return HttpResponseRedirect(reverse('index')) |
594 return HttpResponseRedirect(reverse('index')) |
596 else: |
595 else: |
597 userform = UserForm() |
596 userform = UserForm() |
598 userprofileaddform = UserProfileRegisterForm({'preferred_language' : request.LANGUAGE_CODE}) |
597 userprofileaddform = UserProfileRegisterForm() |
599 |
598 |
600 return render_to_response('site/register.html', {'forms':[userform, userprofileaddform]}, context_instance=RequestContext(request)) |
599 return render_to_response('site/register.html', {'forms':[userform, userprofileaddform]}, context_instance=RequestContext(request)) |