# HG changeset patch # User Sverre Rabbelier # Date 1234396926 0 # Node ID 75332102f83b934d1a6a2947469610e32be61c4b # Parent 5f87d9807b77c92303c67e8d0bb565941630c2af Added an AgreementField widget Displays an Agreement Document in a scrolling text field. The text of the document can be set by modifying the 'text' property. Patch by: Sverre Rabbelier diff -r 5f87d9807b77 -r 75332102f83b app/soc/views/helper/widgets.py --- a/app/soc/views/helper/widgets.py Wed Feb 11 23:59:41 2009 +0000 +++ b/app/soc/views/helper/widgets.py Thu Feb 12 00:02:06 2009 +0000 @@ -145,3 +145,28 @@ self.rf['reference_url'] = reference_url self.rf['filter'] = filter if filter else [] super(ReferenceField, self).__init__(*args, **kwargs) + + +class AgreementField(widgets.Widget): + """Widget for selecting a reference to an Entity. + """ + + HTML_CODE = """ + +
+ %s +
+
+ """ + + def __init__(self, *args, **kwargs): + self.text = "No Agreement Text Specified" + super(AgreementField, self).__init__(*args, **kwargs) + + def render(self, name, value, attrs=None): + """ + """ + + value = self.text.replace('\n', '
') + result = self.HTML_CODE % value + return result