I have a problem in the export to csv the tables whose relationship with others, while in the 'simple' work well. I have to add some basis for export? For example, this is db.Model:
class Categoria(db.Model):
__tablename__ = 'categorie'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
categoria = db.Column(db.String(30), primary_key=True)
tipo_id = db.Column(db.Integer, db.ForeignKey('tipi.id'), primary_key=True)
tipo = db.relationship('Tipo', backref='categorie')
and this the ModelView
class CategorieAdmin(sqla.ModelView):
column_display_pk = True
can_export = True
export_types = ['xls']
list_columns = ['categoria', 'tipo']
The error generate is: Exception: Unexpected data type <class '__main__.Tipo'>
Thanks for help
tipo
here:list_columns = ['categoria', 'tipo']
withtipo_id
– Silici