-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Hi,
I managed to generate forms by overriding the form generation of a ModelView.
But before that, I could update my foreign keys with a dropdown on the relationship. I managed to include the foreign keys with the option but I need to manually set their values.
I did not find a solution for a generic based relationship generation under the documentation.
sample of my admin/views.py
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView
from supervisor import models
from wtforms_alchemy import ModelForm
class AdminModelView(ModelView):
def is_accessible(self):
return current_user.is_authenticated
def scaffold_form(self):
class AdminModelForm(ModelForm):
class Meta:
model = self.model
include_foreign_keys = True
return AdminModelForm
def init_admin(app, db):
admin = Admin(app, name='Flowlity')
admin.add_view(AdminModelView(models.Company, db.session))
Metadata
Metadata
Assignees
Labels
No labels