A
A
alex_ak12020-05-06 12:45:52
Flask
alex_ak1, 2020-05-06 12:45:52

How to make nested tables in flask-admin?

I have a model

class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
name = Column(String(100))
group_id = Column(Integer, ForeignKey('group.id'))
group = relationship( " Group", back_populates="user" )

class Group(Base):
__tablename__ = 'group'
id = Column(Integer, primary_key=True)
name = Column(String(100))
user = relationship( 'User', back_populates=' group', lazy=True )

admin = Admin(app, name='microblog', template_mode='bootstrap3')
admin.add_view(ModelView(User, db_session))
admin.add_view(ModelView(Group, db_session))


Now it's just two tabs, in the first group, in the second user and a drop-down list of the group in it. But I want to do this - I go into one group and see tables with child users.
How to do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question