sdi/views.py
branchanoop
changeset 239 b706790a1001
parent 236 af8cee5a0a27
child 242 6826f27064c9
--- a/sdi/views.py	Fri Sep 03 16:08:40 2010 +0530
+++ b/sdi/views.py	Fri Sep 03 16:17:19 2010 +0530
@@ -272,15 +272,18 @@
     except Registrant.DoesNotExist:
         raise Http404
 
-    form = EditAddressForm(request.POST, instance=user)
-    if request.method == "POST" and form.is_valid():
-        form.save()
-
-        send_addr_upd_email(user)
+    form = EditAddressForm(instance=user)
+    if request.method == "POST"
+        form = EditAddressForm(request.POST, instance=user)
+        if form.is_valid():
+            form.save()
+            #send_addr_upd_email(user)
+        else:
+            return render_to_response("address_updated.html", {"user":user})
 
         return render_to_response("address_updated.html", {"user":user})
     else:
-        return render_to_response("update_address.html", {"user":user})
+        return render_to_response("update_address.html", {"user":user, 'form':form})
 
 def admin_login(request):
     """ basic login.