Only check executability of a batch when not creating one.

There is no batch yet when creating, so execution is not relevant.
This commit is contained in:
Lance Edgar 2015-07-09 15:45:54 -05:00
parent dc1ef65441
commit 5cbccb175a

View file

@ -468,15 +468,17 @@ class BatchCrud(BaseCrud):
""" """
batch = form.fieldset.model batch = form.fieldset.model
batch.refreshable = self.refreshable batch.refreshable = self.refreshable
return { kwargs = {
'batch': batch, 'batch': batch,
'batch_display': self.batch_display, 'batch_display': self.batch_display,
'batch_display_plural': self.batch_display_plural, 'batch_display_plural': self.batch_display_plural,
'execute_title': self.handler.get_execute_title(batch), 'execute_title': self.handler.get_execute_title(batch),
'execute_enabled': self.executable(batch),
'route_prefix': self.route_prefix, 'route_prefix': self.route_prefix,
'permission_prefix': self.permission_prefix, 'permission_prefix': self.permission_prefix,
} }
if not self.creating:
kwargs['execute_enabled'] = self.executable(batch)
return kwargs
def executable(self, batch): def executable(self, batch):
return self.handler.executable(batch) return self.handler.executable(batch)