Versioning module now does magic

Automatic creation of views/urls for anything registered with reversion, with a small amount of hackage to preserve legacy stuff. (and the DAMNED asset IDs!) I would never get distracted...
This commit is contained in:
2020-08-29 16:23:10 +01:00
parent 8ea96674db
commit d708207ab9
23 changed files with 188 additions and 197 deletions

View File

@@ -22,11 +22,13 @@
<a href="{% url 'profile_detail' pk=version.revision.user.pk %}" class="modal-href">
<img class="media-object img-rounded" src="{{ version.revision.user.profile_picture}}" />
</a>
{% else %}
<img class="media-object img-rounded" src="{% static 'imgs/pyrigs-avatar.png' %}" />
{% endif %}
</div>
<div class="media-body">
<h5>
{{ version.revision.user.name }}
{{ version.revision.user.name|default:'System' }}
<span class="ml-3"><small>{{version.revision.date_created|naturaltime}}</small></span>
</h5>
{% endif %}

View File

@@ -2,15 +2,15 @@
{% load paginator from filters %}
{% load to_class_name from filters %}
{% block title %}{{ title }} Activity Stream{% endblock %}
{% block title %}{{ title|title }} Activity Stream{% endblock %}
{% block js %}
{% include 'partials/version_scripts.html' %}
{% endblock %}
{% block content %}
<div class="col-sm-12">
<h3>{{ title }} Activity Stream</h3>
<div class="col-12">
<h3>{{ title|title }} Activity Stream</h3>
{% include 'partials/activity_table_body.html' %}
{% paginator %}
</div>

View File

@@ -14,20 +14,14 @@
{% for version in object_list %}
<tr>
<th scope="row">{{ version.revision.date_created }}</th>
<td><a href="{{ version.changes.new.get_absolute_url }}">{{version.changes.new|to_class_name}}
{% if version.changes.new.asset_id %}
{{ version.changes.new.asset_id }}
{% else %}
{{ version.changes.new.pk|stringformat:"05d" }}
{% endif %}
</a></td>
<td><a href="{{ version.changes.new.get_absolute_url }}">{{ version.changes.new.display_id|default:version.changes.new.pk }} | {{version.changes.new|to_class_name}}</td>
<td>{{ version.pk }}|{{ version.revision.pk }}</td>
<td>{{ version.revision.user.name|default:"System" }}</td>
<td>
{% if version.changes.old == None %}
{{version.changes.new|to_class_name}} Created
{% else %}
{% include 'version_changes.html' %}
{% include 'partials/version_changes.html' %}
{% endif %}
</td>
</tr>

View File

@@ -2,7 +2,7 @@
{% load to_class_name from filters %}
{% load paginator from filters %}
{% block title %}{{object|to_class_name}} {{ id }} - Revision History{% endblock %}
{% block title %}{{object|to_class_name}} {{ object.display_id|default:object.pk }} - Revision History{% endblock %}
{% block js %}
{% include 'partials/version_scripts.html' %}
@@ -10,7 +10,7 @@
{% block content %}
<div class="col-sm-12">
<h3><a href="{{ object.get_absolute_url }}">{{object|to_class_name}} {{ id }}</a> - Revision History</h3>
<h3><a href="{{ object.get_absolute_url }}">{{object|to_class_name}} {{ object.display_id|default:object.pk }}</a> - Revision History</h3>
{% include 'partials/version_history_table.html' %}
<div>{% paginator %}</div>
</div>