Opened 9 years ago

Closed 9 years ago

#17190 closed Bug (fixed)

NullBooleanSelect uses ugettext, should be ugettext_lazy

Reported by: Raymond Penners Owned by: nobody
Component: Forms Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: yes


See django.forms.widgets:

---	2011-11-10 10:40:05.000000000 +0100
+++	2011-11-10 10:41:05.000000000 +0100
@@ -545,7 +545,7 @@
     A Select Widget intended to be used with NullBooleanField.
     def __init__(self, attrs=None):
-        choices = ((u'1', ugettext('Unknown')), (u'2', ugettext('Yes')), (u'3', ugettext('No')))
+        choices = ((u'1', ugettext_lazy('Unknown')), (u'2', ugettext_lazy('Yes')), (u'3', ugettext_lazy('No')))
         super(NullBooleanSelect, self).__init__(attrs, choices)
     def render(self, name, value, attrs=None, choices=()):

Attachments (1)

17190.diff (2.1 KB) - added by kenth 9 years ago.
patch with tests

Download all attachments as: .zip

Change History (5)

comment:1 Changed 9 years ago by Julien Phalip

Needs tests: set
Triage Stage: UnreviewedAccepted

Thanks for the report. This is correct. Could you provide a test case?

comment:2 Changed 9 years ago by Julien Phalip

Just a quick note. This problem is happening when a widget is instantiated while a form module is loaded, e.g.:

class CommentForm(forms.Form):
    name = forms.CharField(

Changed 9 years ago by kenth

Attachment: 17190.diff added

patch with tests

comment:3 Changed 9 years ago by kenth

Needs tests: unset

Added tests to confirm bug & patch.

comment:4 Changed 9 years ago by Julien Phalip

Resolution: fixed
Status: newclosed

In [17091]:

Fixed #17190 -- Ensured that the NullBooleanSelect widget's options get lazily localized. Thanks to pennersr for the report and to kenth for the patch.

Note: See TracTickets for help on using tickets.
Back to Top