syrusakbary / Flask-SuperAdmin

The best admin interface framework for Flask. With scaffolding for MongoEngine, Django and SQLAlchemy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sqlalchemy ModelAdmin "fields" attribute ignored

371c opened this issue · comments

commented

I investigated this issue and i found out that the latest FlaskSuperAdmin version on the Python cheese shop (pypi) ie. the one installed via pip is not the same as the one on the current master branch - which is the one reflected by the documentation.

The one installed, has an attribute called only, which is taken into account by the get_form method, which is also different.

The get_form method in the model.base.BaseModelAdmin class has different signatures in both version.

The earlier version (which takes into account self.only in computing the only fields to include during form computation) has this signature:

def get_form(self, include_readonly=False):

While the newer version (uses fields attribute to compute the only fields to include in the form) has this signature:

def get_form(self):

The docs refer to the new version - which is not the one installed by pip install Flask-SuperAdmin

I don't recommend you use the PyPI version. It is too outdated, this package is under intensive development in last few months. We had 42 commits last month and a lot of issues solved. I found/fixed a lot of bugs in SQLAlchemy backend.

For now, I'm using SuperAdmin from master. It has some issues, but it is really better than PyPI version.

As a side note... it is probably time to make a new PyPI release.

commented

ok, understood - i'll use the master version.

I agree, it's probably time to update the PyPI version since the docs are already up to date..

Thanks for replying.