mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-04-22 15:44:43 +00:00
force_text for object_repr and condition on history link
This commit is contained in:
parent
acae0a2620
commit
52c337a72c
2 changed files with 5 additions and 2 deletions
|
|
@ -7,9 +7,10 @@ from django.contrib.contenttypes.models import ContentType
|
|||
from django.contrib.admin.util import quote
|
||||
from django.db import models
|
||||
from django.db.models import signals
|
||||
from django.utils.translation import ugettext, ugettext_lazy as _
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.encoding import smart_text
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext, ugettext_lazy as _
|
||||
|
||||
from . import permissions
|
||||
|
||||
|
|
@ -18,7 +19,7 @@ class LogEntryManager(models.Manager):
|
|||
def log_action(self, user_id, obj, action_flag, change_message=''):
|
||||
content_type_id = ContentType.objects.get_for_model(obj).id
|
||||
e = self.model(None, None, user_id, content_type_id,
|
||||
smart_text(obj.id), obj.__unicode__()[:200],
|
||||
smart_text(obj.id), force_text(obj)[:200],
|
||||
action_flag, change_message)
|
||||
e.save()
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@
|
|||
{% block page_title %}{% blocktrans with action=action model_name=model_name %}{{ action_name }} {{ model_name }}{% endblocktrans %}{% endblock page_title %}
|
||||
|
||||
{% block page_title_link %}
|
||||
{% if object.pk %}
|
||||
<a href="{% url view|admin2_urlname:"history" pk=object.pk %}" class="btn btn-info">History</a>
|
||||
{% endif %}
|
||||
{% endblock page_title_link %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue