This is an interesting way of doing it. I don't have it set up so that every user has their own url that contains their db id. Django checks to see if the user is authenticated or not. If I didn't have the url set up in this manner, how would I manage to extract the userprofile? I was seeing something called request.user, but I couldn't get this to work. I googled some more and I got a post talking about the ModelForm. This allowed me to restrict the form fields for the user profile. The issue is that each form field didn't have the default values set to those in the database. (The form "value" parameter). I looked through the ModelForm section of the djangobook, as well as the forms section, and I couldn't come up with anything.
On Jun 22, 2:37 am, Herman Schistad <herman.schis...@gmail.com> wrote: > On Wed, Jun 22, 2011 at 08:28, raj <nano.ri...@gmail.com> wrote: > > I'm trying to create an update_profile form. This form will be able to > > update extended user information that is not in the original form. > > > So, I have a form that allows you to create an account. There a lot of > > other fields that aren't listed in this form. The rest of these fields > > will be found when the user actually logs in. What I can't figure out > > is how to make the class that allows them to update this information. > > Like in the extended user class that I made, I have a save function > > that creates a user and saves it. But I don't want to create another > > user with this form. I simply want to update the current authenticated > > user. I thought there would be an update_user type function in the > > UserManager(), but there isn't. I tried googling and didn't come up > > with much. Help Please? > > I don't quite understand what you mean... > > When you say load the url: /userprofile/1234/ at got your urls.py to > get <id> from the URL. > Then you could load that userprofile from the db with e.g. > > def a_nice_view(request, id): > from django.auth.models import User > userprofile = User.objects.get(pk=id) > ## Then do updating on that profile here ## > userprofile.username = "Somethingnew" > > It's the same way with a form/request, and you can get the userprofile > with: request.user > > All this is pretty basic stuff, and as I've seen you ask a lot of > these questions on django-users I would really advise you to read a > introductory book or do some more tutorials before trying to make > something advanced yourselves. > > -- > With regards, Herman Schistad -- 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.