Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[example error] in the example quickhowto2 page doesnot show properly #1674

Closed
thinksource opened this issue Jul 30, 2021 · 2 comments
Closed
Labels

Comments

@thinksource
Copy link

If you'd like to report a bug in Flask-Appbuilder, fill out the template below. Provide
any extra information that may be useful

Responsible disclosure:
We want to keep Flask-AppBuilder safe for everyone. If you've discovered a security vulnerability
please report to danielvazgaspar@gmail.com.

Environment

Flask-Appbuilder version: 3.1.1

python: 3.8

pip freeze output:

Steps to reproduce

the quickhowto2 example:

1, install data by:
python datatest.py

2,create admin by
flask fab create-admin

3, run app by:
flask run --host 0.0.0.0

4, visit address:
http://localhost:5000/contactchartview/chart/1

and the error happens:

2021-07-30 11:36:37,635:INFO:werkzeug:127.0.0.1 - - [30/Jul/2021 11:36:37] "GET /contactchartview/chart/1 HTTP/1.1" 500 -
Traceback (most recent call last):
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 2463, in __call__
    return self.wsgi_app(environ, start_response)
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 2449, in wsgi_app
    response = self.handle_exception(e)
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1866, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Anaconda3\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Anaconda3\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Anaconda3\lib\site-packages\flask\app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Anaconda3\lib\site-packages\flask_appbuilder\security\decorators.py", line 109, in wraps
    return f(self, *args, **kwargs)
  File "C:\Anaconda3\lib\site-packages\flask_appbuilder\charts\views.py", line 205, in chart
    order_direction="asc",
  File "C:\Anaconda3\lib\site-packages\flask_appbuilder\charts\views.py", line 180, in _get_chart_widget
    group.apply(lst, sort=order_column == ""), self.label_columns
  File "C:\Anaconda3\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 'Gender' and 'Gender'
@enricosecco
Copy link

In views.py line 182 modify:
{"group": "gender", "series": [(aggregate_count, "gender")]},
{"group": "gender.name", "series": [(aggregate_count, "gender")]},
because is not defined an order by object but by object.name
For me this solves.

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Feel free to reopen it if it's still relevant to you. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants