45 |
45 |
46 |
46 |
47 class ReadOnlyBool(forms.widgets.Input): |
47 class ReadOnlyBool(forms.widgets.Input): |
48 """Read only checkbox widget. |
48 """Read only checkbox widget. |
49 """ |
49 """ |
50 input_type = 'checkbox' |
50 input_type = 'text' |
51 |
51 |
52 def render(self, name, value, attrs=None): |
52 def render(self, name, value, attrs=None): |
53 """Render ReadOnlyBool widget as HTML. |
53 """Render ReadOnlyBool widget as HTML. |
|
54 |
|
55 Displays "text" field like ReadOnlyInput, but contents will be one of: |
|
56 * empty (no text at all, just a greyed-out box) if no answer at all |
|
57 * "True" (in the same greyed-out box) if True |
|
58 * "False" (in the same greyed-out box) if False |
54 """ |
59 """ |
55 # TODO(tlarsen): this really should display "Yes" or "No" (wrapped with |
|
56 # ugettext_lazy(), of course), instead of displaying a greyed-out but |
|
57 # toggleable checkbox (that has no effect on the field, though). |
|
58 attrs['readonly'] = 'readonly' |
60 attrs['readonly'] = 'readonly' |
59 return super(ReadOnlyBool, self).render(name, value, attrs) |
61 return super(ReadOnlyBool, self).render(name, value, attrs) |
60 |
62 |
61 |
63 |
62 class TinyMCE(forms.widgets.Textarea): |
64 class TinyMCE(forms.widgets.Textarea): |