Thanks! I will try the first idea, will create separate views. But in this case, I will have to add user authentification code to all 3 views....
Now it looks like this: def user_profile(request, profile_name): currentUser = request.user owner = get_object_or_404(User, username = profile_name) try: ownersProfile = owner.get_profile() except Exception, e: ownersProfile = UserProfile(user=owner) ownersProfile.save() # This is my profile if owner.username == currentUser.username: if request.method == 'POST': print request print HHHT uploadForm = ProfileAvatarEdit(request.POST, request.FILES) handleUploadedFile(request.FILES['avatar']) return HttpResponseRedirect('.') else: form = ProfileAvatarEdit() data = RequestContext(request, { 'owner' : owner, 'ownersProfile' : ownersProfile, 'form' : form, } ) return render_to_response('registration/profile.html', data) Should I use this if owner.username == currentUser.username: in all 3 views which I will have? On Wed, Jun 24, 2009 at 11:42 AM, Daniel Roseman<dan...@roseman.org.uk> wrote: > > On Jun 24, 6:45 am, Oleg Oltar <oltarase...@gmail.com> wrote: >> Hi! >> >> I am writing a small application for user profile management. >> >> I need to display and to process output from 2 form on the page of own >> profile. How can I do it? >> >> 1. Form if to change avatar. (Contains browse and upload buttons) >> 2. Form is for changing user details, e.g. info field, or maybe emails >> >> I want these form to be processed independently. E.g. user can submit >> one without filling another. >> >> I have read a post about similar problem >> here:http://groups.google.com/group/django-users/browse_thread/thread/1ff0... >> but didn't find a solution for me. >> >> e.g. if we have following code: >> if request.method == 'POST': >> form1 = RegistrationForm(request.POST) >> form2 = .......(request.POST) >> >> How to process them? Mean one of them will be empty, and it means I >> don't need to return an error in that case. >> Actually, I need to understand which of them is in post. But how? >> >> Thanks, >> Oleg > > You need to use the 'prefix' parameter when instantiating the form. > http://docs.djangoproject.com/en/dev/ref/forms/api/#prefixes-for-forms > -- > DR. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---