On Mon, Mar 2, 2009 at 7:44 AM, localhorst.1...@gmail.com < localhorst.1...@gmail.com> wrote:
> > hi, > the UserCreationForm has only the fields username, password and > password again. > But i want an optional emailfield in my registration. > > i read the overriding a ModelForm part in the documentation and i > tried this: > > >>> class UserCreationFormExtended(ModelForm): > ... email = model.EmailField() > ... > ... class Meta: > ... model = UserCreationForm() > > but it doesn't work here. > > > ..then again i tried: > > model: > class UserCreationFormExtended(ModelForm): > class Meta: > model = User > fields = ('email') > > > def registration(request): > if request.method == 'GET': > registerForm1 = UserCreationForm() > .. > registerForm5 = UserCreationFormExtended() > return render_to_response('registration/registration.html', > { 'registerForm1' : registerForm1, 'registerForm5' : registerForm5 }) > > if request.method == 'POST': > registerResponse1 = UserCreationForm(request.POST) > registerResponse5 = UserCreationFormExtended(request.POST) > > if registerResponse1.is_valid() and registerResponse5.is_valid(): > userObject = registerResponse1.save(commit = False) > userObject.email = registerResponse5 -> how can i access the > email field value? > userObject.save() > > > > > thanks for help > > > > You've said that it doesn't work, can you be a little more specific, how does it not work. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---