I want to fetch a file on ModelView, a flask-appbbuilder class. I have these models:
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
And these views:
class AulaModelView(ModelView):
datamodel = SQLAInterface(Aula)
related_views = [PerguntaModelView]
class ProfessorModelView(ModelView):
datamodel = SQLAInterface(Professor)
related_views = [AulaModelView]
So, my question is, how can I get and read the uploaded file to do my actions in Aula form in post?
Thanks.