diff options
| -rw-r--r-- | app/dispatch/templates/dispatch/loads/detail.html | 35 | ||||
| -rw-r--r-- | app/dispatch/templatetags/dynamic_key.py | 4 |
2 files changed, 35 insertions, 4 deletions
diff --git a/app/dispatch/templates/dispatch/loads/detail.html b/app/dispatch/templates/dispatch/loads/detail.html index bf6d809..44997ee 100644 --- a/app/dispatch/templates/dispatch/loads/detail.html +++ b/app/dispatch/templates/dispatch/loads/detail.html @@ -3,14 +3,15 @@ {% block title %}Details - {{ object.load_number }}{% endblock %} {% block content %} +{% load dynamic_key %} <div class="row"> <div class="col s12 m6"> <h1>Details for {{object.load_number}}</h1> </div> -</div> +</div> <div class="row"> - <div class="col s12"> + <div class="col s12"> <div class="right-align"> <a class="btn blue" href="{%url 'load_edit' object.id %}">Edit</a> </div> @@ -82,11 +83,37 @@ {% endfor %} </tbody> </table> - </div> </div> + <div class="row"> + <div class="col s12"> + <h4>Recent Changes</h4> + {% for h in object.history.get_queryset %} + {% if h.actor is not None %} + Change By: {{h.actor.first_name}} {{h.actor.last_name}} ( {{h.actor.email}} ) + <table> + <thead> + <th>Field</th> + <th>From</th> + <th>To</th> + </thead> + <tbody> + {% for field, changes in h.changes_dict.items %} + <tr> + <th>{{field}}</th> + <td>{{changes|getindex:0}}</td> + <td>{{changes|getindex:1}}</td> + </tr> + {% endfor %} + </tbody> + </table> + {% endif %} + {% endfor %} + </div> + </div> + -</div> +</div> {% endblock %} diff --git a/app/dispatch/templatetags/dynamic_key.py b/app/dispatch/templatetags/dynamic_key.py index fdd7f10..47a7ef8 100644 --- a/app/dispatch/templatetags/dynamic_key.py +++ b/app/dispatch/templatetags/dynamic_key.py @@ -5,3 +5,7 @@ register = template.Library() @register.filter def keyvalue(dictionary, key): return dictionary.get(key) + +@register.filter +def getindex(my_list, index): + return my_list[index] |
