File tree Expand file tree Collapse file tree 3 files changed +49
-31
lines changed
Expand file tree Collapse file tree 3 files changed +49
-31
lines changed Original file line number Diff line number Diff line change 1+ {% load i18n %}
2+ {% load url from simple_history_compat %}
3+ {% load admin_urls %}
4+
5+ {{ foo }}
6+ < table id ="change-history " class ="table table-bordered table-striped ">
7+ < thead >
8+ < tr >
9+ < th scope ="col "> {% trans 'Object' %}</ th >
10+ < th scope ="col "> {% trans 'Date/time' %}</ th >
11+ < th scope ="col "> {% trans 'Comment' %}</ th >
12+ < th scope ="col "> {% trans 'Changed by' %}</ th >
13+ </ tr >
14+ </ thead >
15+ < tbody >
16+ {% for action in action_list %}
17+ < tr >
18+ < td > < a href ="{% url opts|admin_urlname:'simple_history' object.pk action.pk %} "> {{ action.history_object }}</ a > </ td >
19+ < td > {{ action.history_date }}</ td >
20+ < td > {{ action.get_history_type_display }}</ td >
21+ < td >
22+ {% if action.history_user %}
23+ {% url admin_user_view action.history_user_id as admin_user_url %}
24+ {% if admin_user_url %}
25+ < a href ="{{ admin_user_url }} "> {{ action.history_user }}</ a >
26+ {% else %}
27+ {{ action.history_user }}
28+ {% endif %}
29+ {% else %}
30+ {% trans "None" %}
31+ {% endif %}
32+ </ td >
33+ </ tr >
34+ {% endfor %}
35+ </ tbody >
36+ </ table >
Original file line number Diff line number Diff line change 22{% load i18n %}
33{% load url from simple_history_compat %}
44{% load admin_urls %}
5+ {% load display_list from simple_history_admin_list %}
56
67
78{% block content %}
1112
1213 < div class ="module ">
1314 {% if action_list %}
14- < table id ="change-history " class ="table table-bordered table-striped ">
15- < thead >
16- < tr >
17- < th scope ="col "> {% trans 'Object' %}</ th >
18- < th scope ="col "> {% trans 'Date/time' %}</ th >
19- < th scope ="col "> {% trans 'Comment' %}</ th >
20- < th scope ="col "> {% trans 'Changed by' %}</ th >
21- </ tr >
22- </ thead >
23- < tbody >
24- {% for action in action_list %}
25- < tr >
26- < td > < a href ="{% url opts|admin_urlname:'simple_history' object.pk action.pk %} "> {{ action.history_object }}</ a > </ td >
27- < td > {{ action.history_date }}</ td >
28- < td > {{ action.get_history_type_display }}</ td >
29- < td >
30- {% if action.history_user %}
31- {% url admin_user_view action.history_user_id as admin_user_url %}
32- {% if admin_user_url %}
33- < a href ="{{ admin_user_url }} "> {{ action.history_user }}</ a >
34- {% else %}
35- {{ action.history_user }}
36- {% endif %}
37- {% else %}
38- {% trans "None" %}
39- {% endif %}
40- </ td >
41- </ tr >
42- {% endfor %}
43- </ tbody >
44- </ table >
15+ {% display_list module_name %}
4516 {% else %}
4617 < p > {% trans "This object doesn't have a change history." %}</ p >
4718 {% endif %}
Original file line number Diff line number Diff line change 1+ from django import template
2+
3+ register = template .Library ()
4+
5+
6+ @register .inclusion_tag ("simple_history/_object_history_list.html" ,
7+ takes_context = True )
8+ def display_list (context , cl ):
9+ print str (cl )
10+ context .update ({'foo' : str (cl )})
11+ return context
You can’t perform that action at this time.
0 commit comments