Update flowcell chage_form override
authorDiane Trout <diane@ghic.org>
Wed, 11 Jan 2017 23:26:20 +0000 (15:26 -0800)
committerDiane Trout <diane@ghic.org>
Wed, 11 Jan 2017 23:26:20 +0000 (15:26 -0800)
The old version had hardcode url names which have changed some.
this version uses the named url views to point to started email page,

Additionally I copied and repasted the chunk of object-tools from the
source template.

experiments/urls.py
htsworkflow/templates/admin/experiments/flowcell/change_form.html

index f0fbbf40a8437ea15537497edbad456fb8b65185..18169e8ed3d8c20280238e921d3faa56a307821a 100644 (file)
@@ -16,6 +16,6 @@ urlpatterns = [
     url(r'^config/(?P<fc_id>.+)/json$', flowcell_json),
     url(r'^lanes_for/(?P<username>.+)/json$', lanes_for_json),
     url(r'^file/(?P<key>.+)/?$', read_result_file, name="read_result_file"),
-    url(r'^started/(?P<pk>.+)/$', startedEmail),
-    url(r'^finished/(?P<pk>.+)/$', finishedEmail),
+    url(r'^started/(?P<pk>.+)/$', startedEmail, name='started_email'),
+    url(r'^finished/(?P<pk>.+)/$', finishedEmail, name='finished_email'),
 ]
index 068fbfea4df63e453f2223dd1224e16c92987428..24fea571e9bfdf507342e1c10bf7379f5f7383a3 100644 (file)
@@ -1,11 +1,10 @@
 {% extends "admin/change_form.html" %}
-{% load i18n %}
-{% block object-tools %}
-{% if change %}{% if not is_popup %}
-  <ul class="object-tools">
-    <li><a href="../../../../{{ app_label }}/started/{{ object_id }}/">{% trans "Started Email" %}</a></li>
-    <li><a href="history/" class="historylink">{% trans "History" %}</a></li>
-  {% if has_absolute_url %}<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
-  </ul>
-{% endif %}{% endif %}
+{% load i18n admin_urls %}
+{% block object-tools-items %}
+    <li><a href="{% url 'started_email' pk=object_id %}">{% trans "Started Email" %}</a></li>
+    <li>
+        {% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
+        <a href="{% add_preserved_filters history_url %}" class="historylink">{% trans "History" %}</a>
+    </li>
+    {% if has_absolute_url %}<li><a href="{{ absolute_url }}" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif %}
 {% endblock %}