1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-20 23:41:20 +00:00

Add CustomIdEndpointLinkRowAction

This commit is contained in:
Mo 2022-03-03 03:04:15 +01:00
parent 43b54215d2
commit e1d1ee2f84

View file

@ -14,6 +14,7 @@ from advlabdb.models import (
SemesterExperiment, SemesterExperiment,
) )
from advlabdb.utils import reportBadAttempt, userActiveSemester from advlabdb.utils import reportBadAttempt, userActiveSemester
from flask_admin.model.template import EndpointLinkRowAction
def adminViewIsAccessible(): def adminViewIsAccessible():
@ -174,7 +175,7 @@ class SecureAssistantModelView(CustomModelView):
A default filter has to be implemented to restrict assistants read/write access. A default filter has to be implemented to restrict assistants read/write access.
See on_model_change! See on_model_change!
""" """
raise ModelViewException("Not implemented!") raise NotImplementedError()
def on_model_change(self, form, model, is_created): def on_model_change(self, form, model, is_created):
""" """
@ -204,3 +205,11 @@ class SecureAdminBaseView(BaseView):
class SecureAssistantBaseView(BaseView): class SecureAssistantBaseView(BaseView):
def is_accessible(self): def is_accessible(self):
return assistantViewIsAccessible() return assistantViewIsAccessible()
class CustomIdEndpointLinkRowAction(EndpointLinkRowAction):
def customId(self, row):
raise NotImplementedError()
def render(self, context, row_id, row):
return super().render(context, self.customId(row), row)