Self hosted FLOSS fitness/workout, nutrition and weight tracker
Rename templates and delete unused views
Roland Geiderfb2735483cad
diff --git a/wger/core/templates/navigation.html b/wger/core/templates/navigation.htmlindex a4f19c380..13f286839 100644--- a/wger/core/templates/navigation.html+++ b/wger/core/templates/navigation.html@@ -65,9 +65,7 @@{% if perms.exercises.change_exercise %}<li class="dropdown-divider"></li><li class="dropdown-header">{% translate "Administration" %}</li>- <li><a class="dropdown-item" href="{% url 'exercise:history:overview' %}">{% translate "Exercise edit stream" %}</a></li>- <li><a class="dropdown-item" href="{% url 'exercise:history:overview-history' %}">{% translate "Exercise edit history" %}</a></li>- <li><a class="dropdown-item" href="{% url 'exercise:history:admin-control' %}">{% translate "Exercise history admin control" %}</a></li>+ <li><a class="dropdown-item" href="{% url 'exercise:history:overview' %}">{% translate "Exercise edit history" %}</a></li><li><a class="dropdown-item" href="{% url 'exercise:equipment:list' %}">{% translate "Equipment" %}</a></li><li><a class="dropdown-item" href="{% url 'exercise:muscle:admin-list' %}">{% translate "Muscles" %}</a></li><li><a class="dropdown-item" href="{% url 'exercise:category:list' %}">{% translate "Categories" %}</a></li>diff --git a/wger/exercises/templates/history/list.html b/wger/exercises/templates/history/list.htmldeleted file mode 100644index 08be5054f..000000000--- a/wger/exercises/templates/history/list.html+++ /dev/null@@ -1,71 +0,0 @@-{% extends "base_wide.html" %}-{% load i18n static wger_extras activity_tags %}--<!--- Title--->-{% block title %}{% translate "Exercise edit stream" %}{% endblock %}----{% block header %}--{% endblock %}---<!--- Main Content--->-{% block content %}- <table class="table">- <thead>- <tr>- <th scope="col">{% translate 'User' %}</th>- <th scope="col">{% translate 'Action' %}</th>- <th scope="col">{% translate 'Object' %}</th>- <th scope="col">{% translate 'Time' %}</th>- <th scope="col">{% translate 'Changes' %}</th>- </tr>- </thead>- <tbody>- {% for event in stream %}- <tr>- <th>{{ event.actor }}</th>- <td>- {% if event.verb == modes.CREATED.value %}- <span class="{% fa_class 'plus' %}"></span>- {% elif event.verb == modes.UPDATED.value %}- <span class="{% fa_class 'pen' %}"></span>- {% else %}- {{ event.verb }}- {% endif %}- </td>- <td>- {% if event.action_object.get_absolute_url %}- <a href="{{ event.action_object.get_absolute_url }}">{{ event.action_object }}</a>- {% else %}- {{ event.action_object }}- {% endif %}- </td>- <td>{{ event.timesince }}</td>- <td>...</td>- </tr>- {% endfor %}- </tbody>- </table>--{% endblock %}---<!--- Side bar--->-{% block sidebar %}--{% endblock %}----{% block options %}--{% endblock %}diff --git a/wger/exercises/templates/history/list2.html b/wger/exercises/templates/history/list2.htmldeleted file mode 100644index ec77468a2..000000000--- a/wger/exercises/templates/history/list2.html+++ /dev/null@@ -1,88 +0,0 @@-{% extends "base.html" %}-{% load i18n %}-{% load static %}-{% load wger_extras %}-{% load cache %}-{% load thumbnail %}--<!--- Title--->-{% block title %}{% translate "Exercise edit history" %}{% endblock %}----{% block header %}--{% endblock %}---<!--- Main Content--->-{% block content %}- <div class="accordion" id="accordionExample">- {% for entry in history %}- <div class="card">- <div class="card-header" id="heading{{ entry.record.history_id }}">- <button class="btn btn-link btn-block text-left"- type="button"- data-toggle="collapse"- data-target="#collapse{{ entry.record.history_id }}"- aria-expanded="true"- aria-controls="collapse{{ entry.record.history_id }}">- History entry for {{ entry.record.instance.name }}- <small>{{ entry.record.history_date }}</small>- </button>- </div>- <div id="collapse{{ entry.record.history_id }}"- class="collapse"- aria-labelledby="heading{{ entry.record.history_id }}"- data-parent="#accordionExample">- <div class="card-body">- {% if entry.record.history_type == '~' %}- <table class="table">- <thead>- <tr>- <td>Field</td>- <td>Old</td>- <td>New</td>- </tr>- </thead>- <tbody>- {% if entry.delta %}- {% for change in entry.delta.changes %}- <tr>- <td>{{ change.field }}</td>- <td>{{ change.old }}</td>- <td>{{ change.new }}</td>- </tr>- {% endfor %}- {% endif %}- </tbody>- </table>- {% elif entry.record.history_type == '-' %}- <p>Entry deleted</p>- {% elif entry.record.history_type == '+' %}- <p>Entry created</p>- {% endif %}- </div>- </div>- </div>- {% endfor %}- </div>-{% endblock %}---<!--- Side bar--->-{% block sidebar %}--{% endblock %}----{% block options %}--{% endblock %}diff --git a/wger/exercises/templates/history/list3.html b/wger/exercises/templates/history/overview.htmlsimilarity index 100%rename from wger/exercises/templates/history/list3.htmlrename to wger/exercises/templates/history/overview.htmldiff --git a/wger/exercises/urls.py b/wger/exercises/urls.pyindex 279fc5b90..37b150d2c 100644--- a/wger/exercises/urls.py+++ b/wger/exercises/urls.py@@ -36,9 +36,11 @@ from wger.exercises.views import (# sub patterns for historypatterns_history = [- path('overview', history.overview, name='overview'),- path('overview-history', history.overview2, name='overview-history'),- path('admin-control', history.control, name='admin-control'),+ path(+ 'admin-control',+ history.control,+ name='overview'+ ),path('admin-control/revert/<int:history_pk>/<int:content_type_id>',history.history_revert,diff --git a/wger/exercises/views/history.py b/wger/exercises/views/history.pyindex f87355600..3fdffebf7 100644--- a/wger/exercises/views/history.py+++ b/wger/exercises/views/history.py@@ -30,43 +30,11 @@ from actstream.models import Actionfrom actstream import action as actstream_action# wger-from wger.exercises.models import Exercisefrom wger.exercises.views.helper import StreamVerbs-logger = logging.getLogger(__name__)-@permission_required('exercises.change_exercise')-def overview(request):- """- Generic view to list the history of the exercises- """-- context = {- 'stream': Action.objects.all(),-- # We can't pass the enum to the template, so we have to do this- # https://stackoverflow.com/questions/35953132/- 'modes': StreamVerbs.__members__- }-- return render(request, 'history/list.html', context)---@permission_required('exercises.change_exercise')-def overview2(request):- """- Generic view to list the history of the exercises- """- out = []- for entry in Exercise.history.all():- if entry.prev_record:- out.append({'record': entry, 'delta': entry.diff_against(entry.prev_record)})-- return render(request, 'history/list2.html', {'history': out})--@permission_required('exercises.change_exercise')def control(request):"""@@ -91,7 +59,7 @@ def control(request):out.append(data)- return render(request, 'history/list3.html', {+ return render(request, 'history/overview.html', {'context': out,# We can't pass the enum to the template, so we have to do this@@ -117,4 +85,4 @@ def history_revert(request, history_pk, content_type_id):info='reverted history by admin')- return HttpResponseRedirect(reverse('exercise:history:admin-control'))+ return HttpResponseRedirect(reverse('exercise:history:overview'))