dpgaspar / Flask-AppBuilder

Simple and rapid application development framework, built on top of Flask. includes detailed security, auto CRUD generation for your models, google charts and much more. Demo (login with guest/welcome) - http://flaskappbuilder.pythonanywhere.com/
BSD 3-Clause "New" or "Revised" License
4.66k stars 1.36k forks source link

example quickcharts : app:Exception on /countrygroupbychartview/chart/ #2253

Open LeiYangGH opened 3 months ago

LeiYangGH commented 3 months ago

Environment

windows 11, also reproduced in ubuntu 20

Flask-Appbuilder version:

4.5.0

pip freeze output:

aliyun-python-sdk-core==2.13.36 aliyun-python-sdk-kms==2.16.1 apispec==6.6.1 appdirs==1.4.4 async-timeout==4.0.3 atomicwrites==1.4.0 attrs==21.2.0 azure-core==1.24.2 azure-identity==1.10.0 Babel==2.15.0 bcrypt==4.0.1 blinker==1.6.2 Brotli==1.1.0 cachelib==0.9.0 cachetools==4.2.4 cattrs==1.9.0 cerence @ file:///C:/GL/ncs/tts/mobility-ncs-tts-tools/cerence-tts-oc2-proto-python certifi==2021.10.8 cffi==1.15.1 charset-normalizer==2.0.7 click==8.1.4 colorama==0.4.6 ConfigArgParse==1.7 crcmod==1.7 cryptography==37.0.4 dataclasses-json==0.6.7 deepmerge==1.1.0 Deprecated==1.2.14 dnspython==2.6.1 dohq-artifactory==0.7.742 email_validator==2.2.0 et-xmlfile==1.1.0 exceptiongroup==1.1.3 Faker==18.7.0 filelock==3.0.4 Flask==2.3.2 Flask-AppBuilder==4.5.0 Flask-Babel==2.0.0 Flask-BasicAuth==0.2.0 Flask-Caching==2.3.0 Flask-Cors==4.0.0 Flask-JSON==0.4.0 Flask-JWT-Extended==4.6.0 Flask-Limiter==3.7.0 Flask-Login==0.6.3 Flask-SQLAlchemy==2.5.1 Flask-WTF==1.2.1 future==0.18.3 gevent==24.2.1 geventhttpclient==2.0.11 gitdb==4.0.9 GitPython==3.1.24 google-api-core==2.8.2 google-api-python-client==2.51.0 google-auth==2.3.2 google-auth-httplib2==0.1.0 googleapis-common-protos==1.56.2 greenlet==3.0.3 grpcio==1.46.3 grpcio-tools==1.46.3 httplib2==0.20.1 idna==3.3 importlib-metadata==4.12.0 importlib-resources==5.10.0 iniconfig==1.1.1 itsdangerous==2.1.2 Jinja2==3.1.2 jmespath==0.10.0 jsonschema==4.16.0 kubernetes==19.15.0 limits==3.13.0 locust==2.18.4 lxml==4.6.3 markdown-it-py==3.0.0 MarkupSafe==2.1.1 marshmallow==3.21.3 marshmallow-sqlalchemy==0.28.2 mdurl==0.1.2 msal==1.18.0 msal-extensions==1.0.0 msgpack==1.0.8 mypy-extensions==1.0.0 natsort==8.3.1 netmiko==4.2.0 nlu-spec-extract @ file:///C:/GL/ncs/tts/onecloud2.0/qa/nlu-spec-extract ntc_templates==4.0.1 numpy==1.21.4 oauthlib==3.1.1 openpyxl==3.1.2 ordered-set==4.1.0 orjson==3.10.5 oss2==2.18.0 packaging==21.3 pandas==1.3.4 paramiko==3.3.1 pkgutil_resolve_name==1.3.10 pluggy==1.0.0 portalocker==2.5.1 prison==0.2.1 protobuf==3.20.1 psutil==5.9.8 py==1.11.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 PyAudio @ file:///C:/NuanTools/py_tts/PyAudio-0.2.11-cp38-cp38-win32.whl pycparser==2.21 pycryptodome==3.18.0 pygame==2.1.2 Pygments==2.18.0 PyJWT==2.8.0 PyMuPDF==1.23.3 PyMuPDFb==1.23.3 PyMySQL==1.1.0 PyNaCl==1.5.0 PyOgg @ file:///C:/G/PyOgg pyparsing==2.4.7 pyproj==3.5.0 pyrsistent==0.18.1 pyserial==3.5 pytest==7.4.0 pytest-datadir==1.4.1 pytest-html==3.2.0 pytest-metadata==2.0.4 python-dateutil==2.8.2 python-gitlab==3.15.0 python-Levenshtein==0.12.2 pytz==2021.3 pywin32==304 PyYAML==6.0 pyzmq==25.1.2 qa @ file:///C:/GL/ncs/tts/onecloud2.0/qa/qa redis==5.0.1 redlock-py==1.0.8 requests==2.26.0 requests-cache==0.8.1 requests-oauthlib==1.3.0 requests-toolbelt==1.0.0 rich==13.7.1 roundrobin==0.0.4 rsa==4.7.2 rsqa @ file:///C:/GL/ncs/tts/onecloud2.0/qa/rsqa scp==0.14.5 six==1.16.0 smmap==5.0.0 sounddevice==0.4.6 soundfile==0.12.1 SQLAlchemy==1.4.52 SQLAlchemy-Utils==0.41.2 teamcity-messages==1.21 textfsm==1.1.3 thefuzz==0.19.0 tinydb==4.6.1 tomli==2.0.1 tts-grpc-python-client @ file:///C:/GL/ncs/tts/mobility-ncs-tts-tools/tts-grpc-python-client typing-inspect==0.9.0 typing_extensions==4.3.0 uritemplate==4.1.1 url-normalize==1.4.3 urllib3==1.26.7 websocket-client==1.2.1 Werkzeug==2.3.6 wrapt==1.16.0 WTForms==3.1.2 xhlib @ file:///C:/G/xhlib xmltodict==0.12.0 yamale==4.0.2 zhconv==1.4.3 zipp==3.8.1 zope.event==5.0 zope.interface==6.2

Describe the expected results

when running examples/quickcharts, other views can display but countrygroupbychartview/chart/ throw exception,

the web page http://127.0.0.1:5000/countrygroupbychartview/chart/ shows:

Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

The terminal says:

2024-06-27 09:30:16,662:INFO:werkzeug:127.0.0.1 - - [27/Jun/2024 09:30:16] "GET /static/appbuilder/js/ab.js HTTP/1.1" 304 - 2024-06-27 09:30:17,939:ERROR:app:Exception on /countrygroupbychartview/chart/ [GET] Traceback (most recent call last): File "C:\pv\tts\lib\site-packages\flask\app.py", line 2190, in wsgi_app response = self.full_dispatch_request() File "C:\pv\tts\lib\site-packages\flask\app.py", line 1486, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\pv\tts\lib\site-packages\flask\app.py", line 1484, in full_dispatch_request rv = self.dispatch_request() File "C:\pv\tts\lib\site-packages\flask\app.py", line 1469, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(*view_args) File "C:\pv\tts\lib\site-packages\flask_appbuilder\security\decorators.py", line 137, in wraps return f(self, args, *kwargs) File "C:\pv\tts\lib\site-packages\flask_appbuilder\charts\views.py", line 200, in chart widgets = self._get_chart_widget( File "C:\pv\tts\lib\site-packages\flask_appbuilder\charts\views.py", line 179, in _get_chart_widget group.apply(lst, sort=order_column == ""), self.label_columns File "C:\pv\tts\lib\site-packages\flask_appbuilder\models\group.py", line 343, in apply data = sorted(data, key=self.attrgetter(self.group_bys_cols)) TypeError: '<' not supported between instances of 'Country' and 'Country' 2024-06-27 09:30:17,948:INFO:werkzeug:127.0.0.1 - - [27/Jun/2024 09:30:17] "GET /countrygroupbychartview/chart/ HTTP/1.1" 500 -

Tell us what should happen.

All example pages should open successfully.

image
ThomasP0815 commented 3 months ago

related to #1674 change country to country.name