On Feb 3, 11:02 pm, Praveen <praveen.python.pl...@gmail.com> wrote: > Oops... yeah Brian that i forgot to make it as a foriegn key to the > user table and that might be surprised without making foriegn key i > did not get any error even though my settings.DEBUG is true. but now i > made user field in MemberProfile but the same problem my form data is > not saving to foriegn key. > > Please assume the user as foriegn key to the user table on same link > > http://dpaste.com/116096/ > > or may see herehttp://dpaste.com/116432/ > > Thanks
Well, I'm not sure you are catching the right exception. If you look at the source code to get_profile() you can see it raises SiteProfileNotAvailable, not ObjectDoesNotExist (I'm assuming you are running trunk or something recent). However I would still expect you to receive a 500 error for the uncaught exception. Why don't you try running the code interactively in the python shell and see what happens? Do something like: $ python manage.py shell >>> from django.contrib.auth.models import User >>> u = User.objects.get(pk=xxx) # where xxx is a key you know has a profile >>> p = u.get_profile() Just make sure that works first without an exception. That may tell us something. It is also strange that you are passing in request.user to the form.save(), but then you turn around and get another user object (user_obj). Your profile is calling user.get_profile(), but you are saving the 2nd user (user_obj.save()). Probably not your problem, but you might want to clean up that code. I'm not sure why you are saving user_obj anyway, you don't seem to change it. And finally your form save() method isn't returning anything explicitly (and thus implicitly returning None), but your form code is catching the return value (although you don't do anything with it). Good luck. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---