# HG changeset patch # User Sverre Rabbelier # Date 1234709682 0 # Node ID 77931c5841996ed488e7c208139f34d4d96ac27a # Parent b0633dce64928849933a6cc74940ebf493a37a71 Add a PlainTextWidget Patch by: Sverre Rabbelier diff -r b0633dce6492 -r 77931c584199 app/soc/views/helper/widgets.py --- a/app/soc/views/helper/widgets.py Sun Feb 15 13:59:36 2009 +0000 +++ b/app/soc/views/helper/widgets.py Sun Feb 15 14:54:42 2009 +0000 @@ -37,16 +37,30 @@ class ReadOnlyInput(forms.widgets.Input): """Read only input widget. """ + input_type = 'text' def render(self, name, value, attrs=None): """Render ReadOnlyInput widget as HTML. """ + attrs['readonly'] = 'readonly' attrs['class'] = 'plaintext' + return super(ReadOnlyInput, self).render(name, value, attrs) +class PlainTextWidget(forms.widgets.Widget): + """Read only input widget. + """ + + def render(self, name, value, attrs=None): + """Render ReadOnlyInput widget as HTML. + """ + + return str(value) if value else "" + + class FullTinyMCE(forms.widgets.Textarea): """TinyMCE widget.