Edit functionality when there is a relationship with m2m table #541
-
Good afternoon, I've faced strange problem which was caused by the number of records in the M2M table (to be specific, when Using: Current database schema like this:
user_view.py from sqladmin import ModelView
from models.user import User
class UserView(ModelView, model=User):
can_create = False
can_edit = True
can_delete = False
can_view_details = True
column_list = [
"id",
"name",
]
column_searchable_list = [
"id",
"name",
] admin.py from fastapi import FastAPI
from sqladmin import Admin
from user_view import UserView
def init_admin(app: FastAPI) -> None:
admin = Admin(
app=app,
engine=engine,
authentication_backend=...,
title="App admin",
)
admin.add_view(UserView) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
So if I understand correctly it's the Edit page which is building the HTML select field and by default loads all fields. Another option is to use ajax for form options: https://aminalaee.dev/sqladmin/configurations/#form-options |
Beta Was this translation helpful? Give feedback.
So if I understand correctly it's the Edit page which is building the HTML select field and by default loads all fields. Another option is to use ajax for form options: https://aminalaee.dev/sqladmin/configurations/#form-options