open-law/app/controllers/admin/protected_model_view.py

12 lines
289 B
Python
Raw Normal View History

2023-06-08 11:35:40 +00:00
from flask_admin.contrib.sqla import ModelView
from flask_login import current_user
class ProtectedModelView(ModelView):
action_disallowed_list = ["delete"]
column_default_sort = "id"
can_create = False
def is_accessible(self):
return current_user.is_super_user