Let a batch disallow bulk-deletion of its rows
This commit is contained in:
parent
2c14dce30d
commit
72ae1191a0
|
@ -386,7 +386,7 @@ class BatchMasterView(MasterView):
|
|||
return HTML.tag('p', c=link)
|
||||
|
||||
def make_batch_row_grid_tools(self, batch):
|
||||
if not batch.executed and self.request.has_perm('{}.delete_rows'.format(self.get_permission_prefix())):
|
||||
if self.rows_bulk_deletable and not batch.executed and self.request.has_perm('{}.delete_rows'.format(self.get_permission_prefix())):
|
||||
url = self.request.route_url('{}.delete_rows'.format(self.get_route_prefix()), uuid=batch.uuid)
|
||||
return HTML.tag('p', c=tags.link_to("Delete all rows matching current search", url))
|
||||
|
||||
|
@ -881,6 +881,7 @@ class BatchMasterView(MasterView):
|
|||
"Refresh data for {}".format(model_title))
|
||||
|
||||
# bulk delete rows
|
||||
if cls.rows_bulk_deletable:
|
||||
config.add_route('{}.delete_rows'.format(route_prefix), '{}/{{uuid}}/rows/delete'.format(url_prefix))
|
||||
config.add_view(cls, attr='bulk_delete_rows', route_name='{}.delete_rows'.format(route_prefix),
|
||||
permission='{}.delete_rows'.format(permission_prefix))
|
||||
|
|
|
@ -84,6 +84,7 @@ class MasterView(View):
|
|||
rows_creatable = False
|
||||
rows_editable = False
|
||||
rows_deletable = False
|
||||
rows_bulk_deletable = False
|
||||
|
||||
@property
|
||||
def Session(self):
|
||||
|
|
Loading…
Reference in a new issue