# HG changeset patch # User rougeronj # Date 1425658658 -3600 # Node ID 97afeb38e2596c753be83d85df2969d4b08fe59c # Parent f2e44ee54f612d9a78a333746f6175f99c510da7 hide the switch-shape dropdown when its a saved renkan (id_rk is set) diff -r f2e44ee54f61 -r 97afeb38e259 src/hdalab/templates/renkan_edit.html --- a/src/hdalab/templates/renkan_edit.html Fri Mar 06 15:34:45 2015 +0100 +++ b/src/hdalab/templates/renkan_edit.html Fri Mar 06 17:17:38 2015 +0100 @@ -186,6 +186,7 @@

RENKAN

+ {% if switch_shape_url %} + {% endif %}
diff -r f2e44ee54f61 -r 97afeb38e259 src/hdalab/views/profile.py --- 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