我想在 ModelView 上获取一个文件,这是一个 flask-appbbuilder 类。我有这些模型:
class Professor(User):
pass
class Aula(Model):
id = Column(Integer, primary_key=True)
professor_id = Column(Integer, ForeignKey('ab_user.id'), nullable=False)
professor = relationship('Professor')
conteudo = Column(String(200), nullable=False)
data_aula = Column(DateTime, nullable=False)
arquivo = Column(FileColumn()) # <-- **this file**
#arquivo_path = Column(String(255), nullable=True)
def __repr__(self):
return self.data_aula
而这些观点:
class AulaModelView(ModelView):
datamodel = SQLAInterface(Aula)
related_views = [PerguntaModelView]
class ProfessorModelView(ModelView):
datamodel = SQLAInterface(Professor)
related_views = [AulaModelView]
所以,我的问题是,我怎样才能获取并阅读上传的文件以在帖子中以 Aula 形式执行我的操作?
谢谢。