src/hdalab/views/profile.py
changeset 490 97afeb38e259
parent 473 f469ab22542d
child 529 f479d60ca502
--- a/src/hdalab/views/profile.py	Fri Mar 06 15:34:45 2015 +0100
+++ b/src/hdalab/views/profile.py	Fri Mar 06 17:17:38 2015 +0100
@@ -166,25 +166,25 @@
             hr = get_object_or_404(HdalabRenkan.objects.select_related("renkan", "renkan__owner"), renkan__rk_id=rk_id) #.get(=rk_id)
             if hr.renkan.owner!=self.request.user or hr.state!=HdalabRenkan.EDITION:
                 raise Exception("You are not allowed to edit this renkan")
-        
+        else:
+            current_url = self.request.get_full_path()
+            switch_shape_url["current"] = current_url
+            if "shape=horiz" in current_url:
+                switch_shape_url["vert"] = current_url.replace("&shape=horiz", "&shape=vert")
+                switch_shape_url["circle"] = current_url.replace("&shape=horiz", "")
+            elif "shape=vert" in current_url:
+                switch_shape_url["horiz"] = current_url.replace("&shape=vert", "&shape=horiz")
+                switch_shape_url["circle"] = current_url.replace("&shape=vert", "")
+            else:
+                #if we generated the renkan from no filter, the url doesn't have any "?"
+                #we add one to create the links to the other representation
+                if "?" not in current_url:
+                    current_url += "?"
+                switch_shape_url["horiz"] = current_url + "&shape=horiz"
+                switch_shape_url["vert"] = current_url + "&shape=vert"
+            context["switch_shape_url"] = switch_shape_url
         form = AuthenticationForm(self.request)
         context["form"] = form
-        current_url = self.request.get_full_path()
-        switch_shape_url["current"] = current_url
-        if "shape=horiz" in current_url:
-            switch_shape_url["vert"] = current_url.replace("&shape=horiz", "&shape=vert")
-            switch_shape_url["circle"] = current_url.replace("&shape=horiz", "")
-        elif "shape=vert" in current_url:
-            switch_shape_url["horiz"] = current_url.replace("&shape=vert", "&shape=horiz")
-            switch_shape_url["circle"] = current_url.replace("&shape=vert", "")
-        else:
-            #if we generated the renkan from no filter, the url doesn't have any "?"
-            #we add one to create the links to the other representation
-            if "?" not in current_url:
-                current_url += "?"
-            switch_shape_url["horiz"] = current_url + "&shape=horiz"
-            switch_shape_url["vert"] = current_url + "&shape=vert"
-        context["switch_shape_url"] = switch_shape_url
         
         return context