Commits

Chris Perkins committed 86c5b23

fixes.

  • Participants
  • Parent commits d7d68d8

Comments (0)

Files changed (2)

src/tgext/subform/controller.py

 class SubformController(CrudRestController):
     
     def _get_subtype(self, name):
-        model = None
+        model = self.model
         field = self.provider.get_field(self.model, name)
         if hasattr(field, 'argument'):
             model = field.argument

src/tgext/subform/widgets.py

 from formencode import Invalid
 from tw.core import Widget, JSLink, CSSLink
 from tw.forms import SubmitButton
+from tw.dojo import dojo_js
 from tg.decorators import without_trailing_slash
 
 from sprox.widgets import PropertySingleSelectField
 
 select_field_with_add_js = JSLink(modname="tgext.subform",
                        filename="static/javascript/select_field_with_add.js",
+                       javascript=[dojo_js,]
                        )
 
 select_field_with_add_css = CSSLink(modname="tgext.subform",
         target = self._target
         target_name = target.__name__.lower()
 
+        if related_subforms is None:
+            related_subforms = []
         related_subforms = ['%s_%s_subform'%(i, target_name) for i in related_subforms]
             
         d['subform_id'] = form_id
         d['add_form'] = self.__subform__
         d['model_name'] = self.field_name
         d['subform_js'] = SubformJS(form_id=form_id,
-                                    subtype=target_name,
+                                    subtype=self.field_name,
                                     pk_names="','".join(pk_names),
                                     related_subforms="','".join(related_subforms),
                                     display_field_name=display_field_name);