]> asedeno.scripts.mit.edu Git - bluechips.git/blobdiff - bluechips/widgets/__init__.py
Correct conversion of UserSelect field
[bluechips.git] / bluechips / widgets / __init__.py
index e4c2d0a614a63a06c12404956510f1c0b55f476f..8c25e78c37af0f2794228388d0487317af341fd0 100644 (file)
@@ -15,8 +15,11 @@ class UserSelect(forms.SingleSelectField):
     
     options = getUserList
     validator = validators.Wrapper(
-        to_python=(lambda x: meta.Session.query(model.User).get(x)),
-        from_python=(lambda x: x.id))
+        to_python=(lambda x: meta.Session.query(model.User).get(int(x))),
+        from_python=(lambda x: str(x.id)))
+    
+    def _is_option_selected(self, option_value, value):
+        return option_value == value.id
 
 class AmountField(forms.TextField):
     size = 8