Implemented changelog views

This commit is contained in:
Jeremy Stretch
2018-06-20 13:52:54 -04:00
parent a8b11e45c1
commit ddd878683d
17 changed files with 317 additions and 87 deletions

View File

@@ -1,36 +0,0 @@
{% extends base_template %}
{% block title %}{% if obj %}{{ obj }}{% else %}{{ block.super }}{% endif %} - Changelog{% endblock %}
{% block content %}
{% if obj %}<h1>{{ obj }}</h1>{% endif %}
<table class="table">
<thead>
<tr>
<th>Time</th>
<th>User</th>
<th>Action</th>
<th></th>
</tr>
</thead>
<tbody>
{% for change in changes %}
<tr>
<td>{{ change.time }}</td>
<td>{{ change.user }}</td>
<td>{{ change.get_action_display }}</td>
<td>
<button class="btn btn-xs btn-primary" type="button" data-toggle="collapse" data-target="#change{{ change.pk }}" aria-expanded="false" aria-controls="collapseExample">
<i class="fa fa-search"></i>
</button>
</td>
</tr>
<tr class="collapse" id="change{{ change.pk }}">
<td colspan="4">
<pre class="well">{{ change.object_data_pretty }}</pre>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,8 @@
{% extends base_template %}
{% block title %}{% if obj %}{{ obj }}{% else %}{{ block.super }}{% endif %} - Changelog{% endblock %}
{% block content %}
{% if obj %}<h1>{{ obj }}</h1>{% endif %}
{% include 'panel_table.html' with table=objectchanges_table %}
{% endblock %}

View File

@@ -0,0 +1,101 @@
{% extends '_base.html' %}
{% load helpers %}
{% block title %}{{ objectchange }}{% endblock %}
{% block header %}
<div class="row">
<div class="col-sm-8 col-md-9">
<ol class="breadcrumb">
<li><a href="{% url 'extras:objectchange_list' %}">Changelog</a></li>
<li>{{ objectchange }}</li>
</ol>
</div>
<div class="col-sm-4 col-md-3">
<form action="{% url 'extras:objectchange_list' %}" method="get">
<div class="input-group">
<input type="text" name="q" class="form-control" />
<span class="input-group-btn">
<button type="submit" class="btn btn-primary">
<span class="fa fa-search" aria-hidden="true"></span>
</button>
</span>
</div>
</form>
</div>
</div>
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-5">
<div class="panel panel-default">
<div class="panel-heading">
<strong>Change</strong>
</div>
<table class="table table-hover panel-body attr-table">
<tr>
<td>Time</td>
<td>
{{ objectchange.time }}
</td>
</tr>
<tr>
<td>User</td>
<td>
{{ objectchange.user|default:objectchange.user_name }}
</td>
</tr>
<tr>
<td>Action</td>
<td>
{{ objectchange.get_action_display }}
</td>
</tr>
<tr>
<td>Content Type</td>
<td>
{{ objectchange.content_type }}
</td>
</tr>
<tr>
<td>Object</td>
<td>
{% if objectchange.changed_object.get_absolute_url %}
<a href="{{ objectchange.changed_object.get_aboslute_url }}">{{ objectchange.changed_object }}</a>
{% else %}
{{ objectchange.object_repr }}
{% endif %}
</td>
</tr>
<tr>
<td>Request ID</td>
<td>
{{ objectchange.request_id }}
</td>
</tr>
</table>
</div>
</div>
<div class="col-md-7">
<div class="panel panel-default">
<div class="panel-heading">
<strong>Object Data</strong>
</div>
<div class="panel-body">
<pre>{{ objectchange.object_data_pretty }}</pre>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{% include 'panel_table.html' with table=related_changes_table heading='Related Changes' %}
{% if related_changes_count > related_changes_table.rows|length %}
<div class="pull-right">
<a href="{% url 'extras:objectchange_list' %}?request_id={{ objectchange.request_id }}" class="btn btn-primary">See all {{ related_changes_count|add:"1" }} changes</a>
</div>
{% endif %}
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,17 @@
{% extends '_base.html' %}
{% load buttons %}
{% block content %}
<div class="pull-right">
{% export_button content_type %}
</div>
<h1>{% block title %}Changelog{% endblock %}</h1>
<div class="row">
<div class="col-md-9">
{% include 'utilities/obj_table.html' %}
</div>
<div class="col-md-3">
{% include 'inc/search_panel.html' %}
</div>
</div>
{% endblock %}