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