diff --git a/tailbone/views/batch/core.py b/tailbone/views/batch/core.py index 83412761..29aa308e 100644 --- a/tailbone/views/batch/core.py +++ b/tailbone/views/batch/core.py @@ -786,28 +786,30 @@ class BatchMasterView(MasterView): route_prefix = self.get_route_prefix() use_buefy = self.get_use_buefy() + schema = None if self.has_execution_options(batch): if batch is None: batch = self.model_class schema = self.make_execute_schema(batch) - for field in schema: + if schema: + for field in schema: - # if field does not yet have a default, maybe provide one from session storage - if field.default is colander.null: - key = 'batch.{}.execute_option.{}'.format(batch.batch_key, field.name) - if key in self.request.session: - defaults[field.name] = self.request.session[key] + # if field does not yet have a default, maybe provide one from session storage + if field.default is colander.null: + key = 'batch.{}.execute_option.{}'.format(batch.batch_key, field.name) + if key in self.request.session: + defaults[field.name] = self.request.session[key] - # make sure field label is preserved - if field.title: - labels = kwargs.setdefault('labels', {}) - labels[field.name] = field.title + # make sure field label is preserved + if field.title: + labels = kwargs.setdefault('labels', {}) + labels[field.name] = field.title - # auto-convert select widgets for buefy theme - if use_buefy and isinstance(field.widget, forms.widgets.PlainSelectWidget): - field.widget = dfwidget.SelectWidget(values=field.widget.values) + # auto-convert select widgets for buefy theme + if use_buefy and isinstance(field.widget, forms.widgets.PlainSelectWidget): + field.widget = dfwidget.SelectWidget(values=field.widget.values) - else: + if not schema: schema = colander.Schema() kwargs['use_buefy'] = use_buefy