some widget adjustments tls-sprint
authorsylvain.thenault@logilab.fr
Tue, 12 May 2009 20:18:19 +0200
branchtls-sprint
changeset 1758 d46f59e5efd3
parent 1757 fbb9928bf4f1
child 1764 73dc7ad124aa
some widget adjustments
web/formfields.py
--- a/web/formfields.py	Tue May 12 20:17:49 2009 +0200
+++ b/web/formfields.py	Tue May 12 20:18:19 2009 +0200
@@ -334,6 +334,9 @@
         super(IntField, self).__init__(**kwargs)
         self.min = min
         self.max = max
+        if isinstance(self.widget, TextInput):
+            self.widget.attrs.setdefault('size', 5)
+            self.widget.attrs.setdefault('maxlength', 15)
 
 class BooleanField(Field):
     widget = Radio
@@ -372,7 +375,7 @@
 
 class TimeField(DateField):
     format_prop = 'ui.datetime-format'
-    widget = TextInput 
+    widget = TextInput
 
 class HiddenInitialValueField(Field):
     def __init__(self, visible_field):
@@ -384,6 +387,7 @@
 
 class RelationField(Field):
     def __init__(self, **kwargs):
+        kwargs.setdefault('sort', False)
         super(RelationField, self).__init__(**kwargs)
 
     @staticmethod