-
-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/history #349
Feature/history #349
Changes from all commits
5ed5123
fb0e73a
4cfe10e
ef77c82
76ab676
6273e68
14d2a20
598b0a7
ae39a26
555588f
4089ad4
82d9e7a
f7ef575
d62b612
7dbf504
a795135
ee1c90c
ee2ca9f
802265b
99ae00a
acae0a2
52c337a
69f2a35
57ef2a4
e5f1940
af11cb0
e7f8170
738e3a9
3844a95
4959a09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
from django import template | ||
from django.db.models.fields import FieldDoesNotExist | ||
|
||
from .. import utils, renderers | ||
from .. import utils, renderers, models | ||
|
||
|
||
register = template.Library() | ||
|
@@ -136,3 +136,10 @@ def render(context, model_instance, attribute_name): | |
# It must be a method instead. | ||
field = None | ||
return renderer(value, field) | ||
|
||
|
||
@register.inclusion_tag('djadmin2theme_default/includes/history.html', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A hard-coded link to the default theme. We'll patch this later but we're trying to keep these out. 🔢 This is where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough. Should have a conventions area in the contrib docs about template paths. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough. I'll open a ticket. |
||
takes_context=True) | ||
def action_history(context): | ||
actions = models.LogEntry.objects.filter(user__pk=context['user'].pk) | ||
return {'actions': actions} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% if actions %} | ||
<ol class="unstyled"> | ||
{% for action in actions %} | ||
<li> | ||
{% if action.is_addition %} | ||
<i class="added icon-plus"></i> | ||
{% elif action.is_change %} | ||
<i class="changed icon-pencil"></i> | ||
{% else %} | ||
<i class="deleted icon-minus"></i> | ||
{% endif %} | ||
{{ action }} | ||
<span class="muted">{{ action.content_type.model }}</span> | ||
</li> | ||
{% endfor %} | ||
</ol> | ||
{% else %} | ||
<p>None available</p> | ||
{% endif %} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{% extends "djadmin2theme_default/base.html" %} | ||
{% load admin2_tags i18n %} | ||
|
||
{% block title %}{% trans "History for" %} {{ object }}{% endblock title %} | ||
|
||
{% block page_title %}{% trans "History for" %} {{ object }}{% endblock page_title %} | ||
|
||
{% block breadcrumbs %} | ||
<li> | ||
<a href="{% url "admin2:dashboard" %}">{% trans "Home" %}</a> | ||
<span class="divider">/</span> | ||
</li> | ||
<li> | ||
<a href="{% url "admin2:app_index" app_label=app_label %}">{{ app_label|title }}</a> | ||
<span class="divider">/</span> | ||
</li> | ||
<li> | ||
<a href="{% url view|admin2_urlname:"index" %}">{{ model_name_pluralized|title }}</a> | ||
<span class="divider">/</span> | ||
</li> | ||
<li> | ||
<a href="{% url view|admin2_urlname:"detail" pk=object.pk %}">{{ object }}</a> | ||
<span class="divider">/</span> | ||
</li> | ||
<li class="active">{% trans "History" %}</li> | ||
{% endblock breadcrumbs %} | ||
|
||
{% block content %} | ||
|
||
<p> | ||
{% blocktrans with object=object %} | ||
History for {{ object }} | ||
{% endblocktrans %} | ||
|
||
{% if object_list %} | ||
<table class="table table-striped table-bordered"> | ||
<thead> | ||
<tr> | ||
<th>{% trans "Date/Time" %}</th> | ||
<th>{% trans "User" %}</th> | ||
<th>{% trans "Action" %}</th> | ||
<th>{% trans "Message" %}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for log in object_list %} | ||
<tr> | ||
<td>{{ log.action_time }}</td> | ||
<td>{{ log.user }}</td> | ||
<td>{{ log.action_type|capfirst }}</td> | ||
<td>{{ log.change_message }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% else %} | ||
<p>No history for this object.</p> | ||
{% endif %} | ||
{% endblock content %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate to be a jerk, but this single line of code means I can't accept this pull request.
Please read https://django-admin2.readthedocs.org/en/latest/design.html, especially the constraints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
God, you jerk 👯
We'll port that function over soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean jerk or krej? Krej, as you know, is the name of the sauce that Pac Rim Kaiju put on their giant hamburgers.
👊