Предположит, у меня есть эта родительская модель:Как настроить встроенный вид модели/форму модуля Flask-Admin?
class GoogleAccount(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String, index=True)
class GoogleAccountApi(db.Model):
id = db.Column(db.Integer, primary_key=True)
client_secret = db.Column(db.String)
token = db.Column(db.String)
google_account_id = db.Column(db.Integer, db.ForeignKey(GoogleAccount.id))
google_account = db.relationship(GoogleAccount, backref=db.backref('google_account_id', cascade="all, delete-orphan", single_parent=True))
class GoogleAccountView(_ModelView):
inline_models = (models.GoogleAccountApi,)
column_descriptions = dict(
email='Halooo'
)
admin.add_view(GoogleAccountView(models.GoogleAccount, db.session, endpoint='google-account'))
Я знаю, что я могу добавить описание столбца родительской модели (GoogleAccount) с помощью column_descriptions
, но как изменить ребенок описание модели колонки? Такой, что для GoogleAccountAPI.client_secrets
, я могу добавить информацию, говорящую, Click here to authenticate to Google
?
Не уверен, что мне нужно, чтобы добавить вид ребенка для GoogleAcountApi
Спасибо!