You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from flask_admin.contrib.sqla import ModelView
from your_module import YourModel
class CustomModelView(ModelView):
# Override form_columns to exclude view-only relationships
def scaffold_form(self):
form_class = super().scaffold_form()
if hasattr(self.model, '__viewonly__'):
for field_name in self.model.__viewonly__:
if hasattr(form_class, field_name):
delattr(form_class, field_name)
return form_class
admin.add_view(CustomModelView(YourModel))
I have a relationship marked
viewonly
however the edit form for theModelView
still seems to render this field.The text was updated successfully, but these errors were encountered: