Add MasterView.listable flag for disabling grid view

This commit is contained in:
Lance Edgar 2016-08-24 17:20:53 -05:00
parent 11460461e7
commit e296bfd392

View file

@ -50,6 +50,7 @@ class MasterView(View):
pageable = True pageable = True
checkboxes = False checkboxes = False
listable = True
creatable = True creatable = True
viewable = True viewable = True
editable = True editable = True
@ -1114,11 +1115,12 @@ class MasterView(View):
config.add_tailbone_permission_group(permission_prefix, model_title_plural, overwrite=False) config.add_tailbone_permission_group(permission_prefix, model_title_plural, overwrite=False)
# list/search # list/search
config.add_route(route_prefix, '{0}/'.format(url_prefix)) if cls.listable:
config.add_view(cls, attr='index', route_name=route_prefix, config.add_route(route_prefix, '{}/'.format(url_prefix))
permission='{0}.list'.format(permission_prefix)) config.add_view(cls, attr='index', route_name=route_prefix,
config.add_tailbone_permission(permission_prefix, '{0}.list'.format(permission_prefix), permission='{}.list'.format(permission_prefix))
"List/Search {0}".format(model_title_plural)) config.add_tailbone_permission(permission_prefix, '{}.list'.format(permission_prefix),
"List / search {}".format(model_title_plural))
# create # create
if cls.creatable: if cls.creatable:
@ -1131,7 +1133,7 @@ class MasterView(View):
# view # view
if cls.viewable: if cls.viewable:
config.add_tailbone_permission(permission_prefix, '{}.view'.format(permission_prefix), config.add_tailbone_permission(permission_prefix, '{}.view'.format(permission_prefix),
"View {} details".format(model_title)) "View details for {}".format(model_title))
# view by grid index # view by grid index
config.add_route('{}.view_index'.format(route_prefix), '{}/view'.format(url_prefix)) config.add_route('{}.view_index'.format(route_prefix), '{}/view'.format(url_prefix))