Add some smarts when making batch execution form schema

in some cases `has_execution_options()` may return True but the base
view class may not need to provide any options itself (i.e. subclass
is responsible for declaring the view has options).
This commit is contained in:
Lance Edgar 2021-12-15 15:02:28 -06:00
parent ca57bd3572
commit f49fdebd98

View file

@ -786,10 +786,12 @@ 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)
if schema:
for field in schema:
# if field does not yet have a default, maybe provide one from session storage
@ -807,7 +809,7 @@ class BatchMasterView(MasterView):
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