0001-admin-replace-unicode-by-force_text-46563.patch
django_journal/admin.py | ||
---|---|---|
4 | 4 |
from django.contrib.contenttypes.models import ContentType |
5 | 5 |
from django.utils.html import escape |
6 | 6 |
from django.db import models |
7 |
from django.utils.encoding import force_text |
|
7 | 8 |
from django.utils.translation import ugettext_lazy as _ |
8 | 9 |
from django.core.urlresolvers import reverse, NoReverseMatch |
9 | 10 | |
... | ... | |
35 | 36 |
if self.filter_link: |
36 | 37 |
content_type = ContentType.objects.get_for_model(value.__class__) |
37 | 38 |
res = u'<a href="?objectdata__content_type={0}&objectdata__object_id={1}">{2}</a>'.format( |
38 |
content_type.id, value.pk, escape(unicode(value)))
|
|
39 |
content_type.id, value.pk, escape(force_text(value)))
|
|
39 | 40 |
else: |
40 |
res = escape(unicode(value))
|
|
41 |
res = escape(force_text(value))
|
|
41 | 42 |
if self.object_link: |
42 | 43 |
res += self.build_object_link(value) |
43 | 44 |
return res |
... | ... | |
119 | 120 | |
120 | 121 |
def object_filter_link(self, objectdata): |
121 | 122 |
if objectdata.content_object is not None: |
122 |
caption = unicode(objectdata.content_object)
|
|
123 |
caption = force_text(objectdata.content_object)
|
|
123 | 124 |
else: |
124 | 125 |
caption = _(u'<deleted {content_type} {object_id}>').format( |
125 | 126 |
content_type=objectdata.content_type, |
126 |
- |