Chris Perkins avatar Chris Perkins committed 86c5b23

fixes.

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);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.