python - Modify list template in flask admin -
i using flask , flask-admin extension. have 2 models (using sql alchemy):
- project
- task
project has attribute:
tasks = db.relationship('task', backref=db.backref('project')) and tasks self referential tree structure key column in task:
children = db.relationship("task", # cascade deletions cascade="all, delete-orphan", # many 1 + adjacency list - remote_side # required reference 'remote' # column in join condition. backref=db.backref("parent", remote_side=id), # children represented dictionary # on "title" attribute. collection_class=attribute_mapped_collection('title'), ) i want have list template flask-admin shows me projects. done extension , standard list view. want add crud interface (example: http://examples.flask-admin.org/sqla/simple/admin/userview/) tasks should appear upon clicking each on project.
i don't know best way reach goal. thought including iframe task in each table cell of project row. somehow ugly. how can render crud interface tasks belonging project in project list template?
i know flask-admin able link 2 tables (over foreign keys in model), standard way not want, since needs @ least 1 click getting project crud interface task crud interface. want have both crud interfaces loaded on same page.
looking @ documentation looks simple providing inline-models class property project model view:
class projectmodelview(modelview): inline_models = (task, )
Comments
Post a Comment