Created
November 16, 2011 19:29
-
-
Save marekw2143/1371063 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/library/pyjamas/django/Form.py b/library/pyjamas/django/Form.py | |
index 240015c..0c6723d 100644 | |
--- a/library/pyjamas/django/Form.py | |
+++ b/library/pyjamas/django/Form.py | |
@@ -9,8 +9,10 @@ from pyjamas.ui.Grid import Grid | |
from pyjamas.ui.FormPanel import FormPanel | |
#from pyjamas.ui.Composite import Composite | |
from pyjamas.log import writebr | |
+import pdb | |
from pyjamas.ui.TextBox import TextBox | |
+from pyjamas.ui.ListBox import ListBox | |
class CharField(TextBox): | |
def __init__(self, **kwargs): | |
@@ -63,9 +65,17 @@ class FloatField(TextBox): | |
def getValue(self): | |
return self.getText() | |
+class ChoiceField(ListBox): | |
+ def __init__(self, **kwargs): | |
+ ListBox.__init__(self) | |
+ self.choices = kwargs.pop('choices', []) # list of tuples (val, text) | |
+ for v, t in self.choices: | |
+ self.addItem(t, str(v)) | |
+ | |
widget_factory = {'CharField': CharField, | |
'IntegerField': IntegerField, | |
- 'FloatField': FloatField | |
+ 'FloatField': FloatField, | |
+ 'ChoiceField': ChoiceField | |
} | |
class FormSaveGrid: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment