Skip to content

Commit

Permalink
Link commit to changes page in history page (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
kofrezo committed Mar 20, 2023
1 parent c8ff2bb commit 50f024f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions serveradmin/serverdb/templates/serverdb/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h3>History for {{ name }}</h3>
{% for key, value in change.change_json.items %}
{% if not attribute_filter or attribute_filter == key %}
<tr>
<td>{{ change.commit.id }}</td>
<td><a href="{% url 'serverdb_changes' %}?commit_id={{ change.commit.id }}">{{ change.commit.id }}</a></td>
<td>{{ change.commit.change_on|date:"r" }}</td>
<td>{{ change.commit.change_on|timesince }}</td>
<td>{{ change.commit.app|default:"Servershell" }}</td>
Expand All @@ -77,7 +77,7 @@ <h3>History for {{ name }}</h3>
{% if key != 'object_id' %}
{% if not attribute_filter or attribute_filter == key %}
<tr>
<td>{{ change.commit.id }}</td>
<td><a href="{% url 'serverdb_changes' %}?commit_id={{ change.commit.id }}">{{ change.commit.id }}</a></td>
<td>{{ change.commit.change_on|date:"r" }}</td>
<td>{{ change.commit.change_on|timesince }}</td>
<td>{{ change.commit.app|default:"Servershell" }}</td>
Expand Down Expand Up @@ -116,7 +116,7 @@ <h3>History for {{ name }}</h3>
{% endfor %}
{% elif change.change_type == 'delete' %}
<tr class="">
<td>{{ change.commit.id }}</td>
<td><a href="{% url 'serverdb_changes' %}?commit_id={{ change.commit.id }}">{{ change.commit.id }}</a></td>
<td>{{ change.commit.change_on|date:"r" }}</td>
<td>{{ change.channge_commit.change_on|timesince }}</td>
<td>{{ change.commit.app|default:"Servershell" }}</td>
Expand Down
4 changes: 4 additions & 0 deletions serveradmin/serverdb/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def changes(request):
'TIMEZONE': settings.TIME_ZONE, 'RETURN_AS_TIMEZONE_AWARE': True
}

f_commit = request.GET.get('commit_id')
if f_commit:
commits = commits.filter(pk=f_commit)

f_from = request.GET.get('from')
if f_from:
f_from = dateparser.parse(f_from, settings=date_settings)
Expand Down

0 comments on commit 50f024f

Please sign in to comment.