Code

Ticket #4583: databrowser-unicode.diff

File databrowser-unicode.diff, 2.0 KB (added by anonymous, 7 years ago)
Line 
1Index: plugins/calendars.py
2===================================================================
3--- plugins/calendars.py        (revision 5478)
4+++ plugins/calendars.py        (working copy)
5@@ -6,6 +6,7 @@
6 from django.utils.text import capfirst
7 from django.utils.translation import get_date_formats
8 from django.views.generic import date_based
9+from django.utils.encoding import force_unicode
10 import datetime
11 import time
12 
13@@ -29,7 +30,7 @@
14         if not fields:
15             return u''
16         return u'<p class="filter"><strong>View calendar by:</strong> %s</p>' % \
17-            u', '.join(['<a href="calendars/%s/">%s</a>' % (f.name, capfirst(f.verbose_name)) for f in fields.values()])
18+            u', '.join(['<a href="calendars/%s/">%s</a>' % (f.name, force_unicode(capfirst(f.verbose_name))) for f in fields.values()])
19 
20     def urls(self, plugin_name, easy_instance_field):
21         if isinstance(easy_instance_field.field, models.DateField):
22Index: plugins/fieldchoices.py
23===================================================================
24--- plugins/fieldchoices.py     (revision 5478)
25+++ plugins/fieldchoices.py     (working copy)
26@@ -4,7 +4,7 @@
27 from django.contrib.databrowse.sites import DatabrowsePlugin
28 from django.shortcuts import render_to_response
29 from django.utils.text import capfirst
30-from django.utils.encoding import smart_str
31+from django.utils.encoding import smart_str, force_unicode
32 from django.views.generic import date_based
33 import datetime
34 import time
35@@ -33,7 +33,7 @@
36         if not fields:
37             return u''
38         return u'<p class="filter"><strong>View by:</strong> %s</p>' % \
39-            u', '.join(['<a href="fields/%s/">%s</a>' % (f.name, capfirst(f.verbose_name)) for f in fields.values()])
40+            u', '.join(['<a href="fields/%s/">%s</a>' % (f.name, force_unicode(capfirst(f.verbose_name))) for f in fields.values()])
41 
42     def urls(self, plugin_name, easy_instance_field):
43         if easy_instance_field.field in self.field_dict(easy_instance_field.model.model).values():