first of all, I'm not python proof.
I'm not sure to really understand the following sentence about the ModelView
in the doc (http://flask-admin.readthedocs.org/en/latest/api/mod_contrib_sqla/) :
Class inherits configuration options from BaseModelView and they’re not displayed here
As far I understand, a class which inherit from ModelView
should inherits configurations options from BaseModelView
BaseModelView
has a form_columns
method. Then I don't understand why I got the following error ValueError: Invalid model property name <class 'app.models.Idcard'>.n
with the following code:
models.py
class Idcard(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(128), nullable=False)
def __repr__(self):
return '%s' % unicode(self.name)
views.py
class IdcardView(ModelView):
form_columns = ('name')
admin.add_view(IdcardView(Idcard, db.session)
As far I understand the error, the problem comes from the name
in form_columns = ('name')
butthis is clearly a parameter of my model Class Idcard
.
If somebody has an idea ..... !