# HG changeset patch # User Todd Larsen # Date 1232474016 0 # Node ID 9dac40accd069ae6d2f26a237bc18d8ddb0f5ce5 # Parent d3f9fff0860b0f6bbacdd3d6672425b9e5cbc923 Changing ReadOnlyBool to type "text" makes it display "True" or "False". Patch by: Todd Larsen Review by: to-be-reviewed diff -r d3f9fff0860b -r 9dac40accd06 app/soc/models/role.py --- a/app/soc/models/role.py Tue Jan 20 17:41:47 2009 +0000 +++ b/app/soc/models/role.py Tue Jan 20 17:53:36 2009 +0000 @@ -75,6 +75,14 @@ user = db.ReferenceProperty(reference_class=soc.models.user.User, required=True, collection_name='roles') + #: field storing whether User has agreed to the Role-specific Terms of + #: Service. (Not a required field because some Roles may not have special + #: Terms of Service.) + agrees_to_tos = db.BooleanProperty( + verbose_name=ugettext_lazy('Agrees to ToS')) + agrees_to_tos.help_text = ugettext_lazy( + 'Indicates that the user agrees to the Terms of Service for this Role.') + #==================================================================== # (public) name information #==================================================================== diff -r d3f9fff0860b -r 9dac40accd06 app/soc/views/helper/widgets.py --- a/app/soc/views/helper/widgets.py Tue Jan 20 17:41:47 2009 +0000 +++ b/app/soc/views/helper/widgets.py Tue Jan 20 17:53:36 2009 +0000 @@ -47,14 +47,16 @@ class ReadOnlyBool(forms.widgets.Input): """Read only checkbox widget. """ - input_type = 'checkbox' + input_type = 'text' def render(self, name, value, attrs=None): """Render ReadOnlyBool widget as HTML. + + Displays "text" field like ReadOnlyInput, but contents will be one of: + * empty (no text at all, just a greyed-out box) if no answer at all + * "True" (in the same greyed-out box) if True + * "False" (in the same greyed-out box) if False """ - # TODO(tlarsen): this really should display "Yes" or "No" (wrapped with - # ugettext_lazy(), of course), instead of displaying a greyed-out but - # toggleable checkbox (that has no effect on the field, though). attrs['readonly'] = 'readonly' return super(ReadOnlyBool, self).render(name, value, attrs)