On Mar 28, 2:17 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Sat, 2009-03-28 at 13:45 +1100, Joshua Partogi wrote:
> > Dear all,
>
> > I currently want to have a registration system. For that matter I will
> > be using the existing django.contrib.auth.models.User.
>
> > So I created a form object as such:
> > class RegisterForm(ModelForm):
> > class Meta:
> > model = User
>
> > And the view:
> > def form(request):
> > if request.method == 'POST': # If the form has been submitted...
> > form = RegisterForm(request.POST) # A form bound to the POST data
> > if form.is_valid(): # All validation rules pass
> > # Process the data in form.cleaned_data
> > new_member = form.save()
>
> > return HttpResponseRedirect('/register/thanks/') #
> > Redirect after POST
> > else:
> > form = RegisterForm() # An unbound form
>
> > return render_to_response('register/form.html', {
> > 'form': form,
> > })
>
> > But unfortunately I can not save the User object into database.
>
> What happens when you try? The answer could be anywhere from "it fails
> silently" to "my computer caught on fire" or worse, so we can't guess at
> the problem. If you see an error, paste the traceback.
>
> Is form validation passing -- i.e. are you actually getting to the line
> with form.save() in it?
That is exactly the problem. No exception is thrown. But I guess it
didn't pass the validation because it wasn't redirecting to another
page. Which is funny because all the required field in
django.contrib.auth.models.User object is filled in. Am I doing a good
practice anyway for doing registration using this
django.contrib.auth.models.User object?
Best regards,
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---