Skip to content

Commit 7c2c929

Browse files
authored
Allow lazy verbose_name translations
This fixes an issue here: readthedocs/readthedocs.org#2495 I'm not sure if this is the preferred way of doing things, nor am I sure if this project is 2+3? But hopefully this can assist getting the issue solved... feel free to close this PR and implement your own way :)
1 parent 06b1a6d commit 7c2c929

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

django_filters/utils.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import unicode_literals
2+
13
import warnings
24

35
from django.conf import settings
@@ -172,9 +174,9 @@ def verbose_field_name(model, field_name):
172174
names = []
173175
for part in parts:
174176
if isinstance(part, ForeignObjectRel):
175-
names.append(part.related_name)
177+
names.append(str(part.related_name))
176178
else:
177-
names.append(part.verbose_name)
179+
names.append(str(part.verbose_name))
178180

179181
return ' '.join(names)
180182

0 commit comments

Comments
 (0)