pallets-eco / flask-admin

Simple and extensible administrative interface framework for Flask
https://flask-admin.readthedocs.io
BSD 3-Clause "New" or "Revised" License
5.8k stars 1.58k forks source link

example doesn't run #2136

Open hemna opened 3 years ago

hemna commented 3 years ago
└─> python --version
Python 3.8.5
╭─flask-admin on  master via 🐍 v3.8.5 (env) took 22s ❯
└─> python examples/sqla/run_server.py
Traceback (most recent call last):
  File "examples/sqla/run_server.py", line 1, in <module>
    from admin import app
  File "/Users/i530566/devel/mine/tmp/flask-admin/examples/sqla/admin/__init__.py", line 24, in <module>
    import admin.main
  File "/Users/i530566/devel/mine/tmp/flask-admin/examples/sqla/admin/main.py", line 248, in <module>
    admin.add_view(UserAdmin(User, db.session))
  File "/Users/i530566/devel/mine/tmp/flask-admin/env/lib/python3.8/site-packages/flask_admin/contrib/sqla/view.py", line 327, in __init__
    super(ModelView, self).__init__(model, name, category, endpoint, url, static_folder,
  File "/Users/i530566/devel/mine/tmp/flask-admin/env/lib/python3.8/site-packages/flask_admin/model/base.py", line 818, in __init__
    self._refresh_cache()
  File "/Users/i530566/devel/mine/tmp/flask-admin/env/lib/python3.8/site-packages/flask_admin/model/base.py", line 910, in _refresh_cache
    self._refresh_forms_cache()
  File "/Users/i530566/devel/mine/tmp/flask-admin/env/lib/python3.8/site-packages/flask_admin/model/base.py", line 835, in _refresh_forms_cache
    self._create_form_class = self.get_create_form()
  File "/Users/i530566/devel/mine/tmp/flask-admin/env/lib/python3.8/site-packages/flask_admin/model/base.py", line 1291, in get_create_form
    return self.get_form()
  File "/Users/i530566/devel/mine/tmp/flask-admin/env/lib/python3.8/site-packages/flask_admin/model/base.py", line 1248, in get_form
    return self.scaffold_form()
  File "/Users/i530566/devel/mine/tmp/flask-admin/env/lib/python3.8/site-packages/flask_admin/contrib/sqla/view.py", line 745, in scaffold_form
    form_class = form.get_form(self.model, converter,
  File "/Users/i530566/devel/mine/tmp/flask-admin/env/lib/python3.8/site-packages/flask_admin/contrib/sqla/form.py", line 552, in get_form
    field = converter.convert(model, mapper, name, prop, field_args.get(name), hidden_pk)
  File "/Users/i530566/devel/mine/tmp/flask-admin/env/lib/python3.8/site-packages/flask_admin/contrib/sqla/form.py", line 263, in convert
    return converter(model=model, mapper=mapper, prop=prop,
  File "/Users/i530566/devel/mine/tmp/flask-admin/env/lib/python3.8/site-packages/flask_admin/contrib/sqla/form.py", line 307, in convert_choice_type
    accepted_values = [key for key, val in available_choices]
  File "/Users/i530566/devel/mine/tmp/flask-admin/env/lib/python3.8/site-packages/flask_admin/contrib/sqla/form.py", line 307, in <listcomp>
    accepted_values = [key for key, val in available_choices]
TypeError: cannot unpack non-iterable EnumChoices object
philomelus commented 3 years ago

Same issue here, using python 3.9.6. Followed the instructions in readme. Other examples run ok (auth, sqla-custom-inline-forms, bootstrap4). I can provide more info is desired.

solsticedhiver commented 3 years ago

I confirmed the exception problem using archlinux and python 3.9.6 and following the instrucitons of the README