Changing ReadOnlyBool to type "text" makes it display "True" or "False".
authorTodd Larsen <tlarsen@google.com>
Tue, 20 Jan 2009 17:53:36 +0000
changeset 841 9dac40accd06
parent 840 d3f9fff0860b
child 842 ed494131f6e5
Changing ReadOnlyBool to type "text" makes it display "True" or "False". Patch by: Todd Larsen Review by: to-be-reviewed
app/soc/models/role.py
app/soc/views/helper/widgets.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
   #====================================================================
--- 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)