Beispiel #1
0
 def get_form(self):
     if self.form:
         return self.form
     schema = self.table.class_handler.record_properties
     return [
         get_default_widget(datatype)(name)
         for name, datatype in schema.items()
     ]
Beispiel #2
0
 def search_widgets(self):
     widgets = []
     schema = self.search_cls.class_schema
     for name in self.search_fields:
         datatype = schema[name]
         title = getattr(datatype, 'title', name)
         widget = get_default_widget(datatype)(name, title=title)
         widgets.append(widget)
     return widgets
Beispiel #3
0
    def get_widget(self, name, datatype):
        title = getattr(datatype, 'title', name)
        widget = getattr(datatype, 'widget', None)
        if widget is None:
            widget = get_default_widget(datatype)

        # Keep datatype attributes on widget if None
        kw = {'title': title}
        for attr_name in attr_keys:
            attr_value = getattr(datatype, attr_name, None)
            if attr_value is not None and attr_value != '':
                kw[attr_name] = attr_value

        return widget(name, **kw)
Beispiel #4
0
 def get_form(self):
     if self.form:
         return self.form
     schema = self.table.class_handler.record_properties
     return [ get_default_widget(datatype)(name)
              for name, datatype in schema.items() ]