enabled photo uploading for user profile.
authoranoop
Tue, 23 Feb 2010 19:42:12 +0530
changeset 60 3eac96608091
parent 59 f6a3bf088a9e
child 61 708dd49d531b
enabled photo uploading for user profile.
taskapp/views/user.py
templates/user/edit_profile.html
--- a/taskapp/views/user.py	Tue Feb 23 17:55:04 2010 +0530
+++ b/taskapp/views/user.py	Tue Feb 23 19:42:12 2010 +0530
@@ -74,7 +74,7 @@
         if request.user.is_authenticated() == True:
             profile = Profile.objects.get(user = request.user)
             data = request.POST#form.cleaned_data
-            properties = {'aboutme':data['aboutme'], 'foss_comm':data['foss_comm'], 'phonenum':data['phonenum'], 'homepage':data['homepage'], 'street':data['street'], 'city':data['city'], 'country':data['country'], 'nick':data['nick']}
+            properties = {'aboutme':data['aboutme'], 'foss_comm':data['foss_comm'], 'phonenum':data['phonenum'], 'homepage':data['homepage'], 'street':data['street'], 'city':data['city'], 'country':data['country'], 'nick':data['nick'],'photo':request.FILES['photo']}
             #fields = ['dob','gender','credits','aboutme','foss_comm','phonenum','homepage','street','city','country','nick']
             updateProfile(profile,properties)
             return redirect('/user/view/uid='+str(profile.user_id))
--- a/templates/user/edit_profile.html	Tue Feb 23 17:55:04 2010 +0530
+++ b/templates/user/edit_profile.html	Tue Feb 23 19:42:12 2010 +0530
@@ -1,6 +1,6 @@
 {% extends 'base.html' %}
 {% block content %}
-    <form action="/user/edit/" method="post">
+    <form action="/user/edit/" enctype = "multipart/form-data" method="post">
         {{ edit_profile_form.as_p }}
     <input type="submit" value="Apply Changes" />
     </form>