app/soc/views/helper/widgets.py
changeset 1337 77931c584199
parent 1308 35b75ffcbb37
child 1542 9de71e8890e7
equal deleted inserted replaced
1336:b0633dce6492 1337:77931c584199
    35 
    35 
    36 
    36 
    37 class ReadOnlyInput(forms.widgets.Input):
    37 class ReadOnlyInput(forms.widgets.Input):
    38   """Read only input widget.
    38   """Read only input widget.
    39   """
    39   """
       
    40 
    40   input_type = 'text'
    41   input_type = 'text'
    41 
    42 
    42   def render(self, name, value, attrs=None):
    43   def render(self, name, value, attrs=None):
    43     """Render ReadOnlyInput widget as HTML.
    44     """Render ReadOnlyInput widget as HTML.
    44     """
    45     """
       
    46 
    45     attrs['readonly'] = 'readonly'
    47     attrs['readonly'] = 'readonly'
    46     attrs['class'] = 'plaintext'
    48     attrs['class'] = 'plaintext'
       
    49 
    47     return super(ReadOnlyInput, self).render(name, value, attrs)
    50     return super(ReadOnlyInput, self).render(name, value, attrs)
       
    51 
       
    52 
       
    53 class PlainTextWidget(forms.widgets.Widget):
       
    54   """Read only input widget.
       
    55   """
       
    56 
       
    57   def render(self, name, value, attrs=None):
       
    58     """Render ReadOnlyInput widget as HTML.
       
    59     """
       
    60 
       
    61     return str(value) if value else ""
    48 
    62 
    49 
    63 
    50 class FullTinyMCE(forms.widgets.Textarea):
    64 class FullTinyMCE(forms.widgets.Textarea):
    51   """TinyMCE widget. 
    65   """TinyMCE widget. 
    52   
    66