X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/be58b3e61477d8007fbd033ab758d30eb652d55e..1c81f61d4e574d439ed2dbfefd599f04b5e2bef9:/contrib/waldo/forms.py?ds=sidebyside diff --git a/contrib/waldo/forms.py b/contrib/waldo/forms.py index 18c22a4..615d302 100644 --- a/contrib/waldo/forms.py +++ b/contrib/waldo/forms.py @@ -56,4 +56,18 @@ class RegistrationForm(UserCreationForm): new_user = User.objects.create_user(username, email, password) new_user.is_active = False new_user.save() - return new_user \ No newline at end of file + return new_user + + +class UserAccountForm(forms.ModelForm): + first_name = User._meta.get_field('first_name').formfield(required=True) + last_name = User._meta.get_field('last_name').formfield(required=True) + email = User._meta.get_field('email').formfield(required=True, widget=EmailInput) + + def __init__(self, user, *args, **kwargs): + kwargs['instance'] = user + super(UserAccountForm, self).__init__(*args, **kwargs) + + class Meta: + model = User + fields = ('first_name', 'last_name', 'email') \ No newline at end of file