Ver código fonte

Cleaned up objectchange table

Jeremy Stretch 7 anos atrás
pai
commit
85efdf8e00
1 arquivos alterados com 13 adições e 2 exclusões
  1. 13 2
      netbox/extras/tables.py

+ 13 - 2
netbox/extras/tables.py

@@ -24,6 +24,10 @@ CONFIGCONTEXT_ACTIONS = """
 {% endif %}
 """
 
+OBJECTCHANGE_TIME = """
+<a href="{{ record.get_absolute_url }}">{{ value|date:"SHORT_DATETIME_FORMAT" }}</a>
+"""
+
 OBJECTCHANGE_ACTION = """
 {% if record.action == 1 %}
     <span class="label label-success">Created</span>
@@ -42,6 +46,10 @@ OBJECTCHANGE_OBJECT = """
 {% endif %}
 """
 
+OBJECTCHANGE_REQUEST_ID = """
+<a href="{% url 'extras:objectchange_list' %}?request_id={{ value }}">{{ value }}</a>
+"""
+
 
 class TagTable(BaseTable):
     pk = ToggleColumn()
@@ -74,7 +82,9 @@ class ConfigContextTable(BaseTable):
 
 
 class ObjectChangeTable(BaseTable):
-    time = tables.LinkColumn()
+    time = tables.TemplateColumn(
+        template_code=OBJECTCHANGE_TIME
+    )
     action = tables.TemplateColumn(
         template_code=OBJECTCHANGE_ACTION
     )
@@ -85,7 +95,8 @@ class ObjectChangeTable(BaseTable):
         template_code=OBJECTCHANGE_OBJECT,
         verbose_name='Object'
     )
-    request_id = tables.Column(
+    request_id = tables.TemplateColumn(
+        template_code=OBJECTCHANGE_REQUEST_ID,
         verbose_name='Request ID'
     )