Flask-Admin: populate popup menu based on value in another table

In my model definition, I have class A and class B.

class B(Model): id = Column(Integer, primary_key=True) max_num = Column(Integer) class A(Model): id = Column(Integer, primary_key=True) b_id = Column(Integer, ForeignKey('B.id')) b = relationship('B') num = Column(Integer)` 

In my Flask-Admin form, create a form for A, I want to create a drop-down menu where num parameters are limited [1, B.max_num] .

For example, if I have B(id=10,max_num=5) , and when the user creates A and selects B with id=10 , the drop-down menu for num should be filled 1,2,3,4,5.

Is it possible?

+4
source share

All Articles