Commits

Gael Pasgrimaud committed 5a052d9

options can be a callable

  • Participants
  • Parent commits bd989a4

Comments (0)

Files changed (2)

File formalchemy/ext/couchdb.py

     return value
 
 class Field(BaseField):
-    """"""
+    """Field for CouchDB FieldSet"""
     def __init__(self, *args, **kwargs):
         self.schema = kwargs.pop('schema')
         if self.schema and 'renderer' not in kwargs:

File formalchemy/fields.py

 
     def render(self, options, **kwargs):
         self.radios = []
+        if callable(options):
+            options = options(self.field.parent)
         for i, (choice_name, choice_value) in enumerate(_extract_options(options)):
             choice_id = '%s_%i' % (self.name, i)
             radio = self.widget(self.name, choice_value, id=choice_id,