PyFolio icon indicating copy to clipboard operation
PyFolio copied to clipboard

TypeError at /portfolio argument of type 'NoneType' is not iterable

Open Rhodesware opened this issue 7 years ago • 0 comments

Occurs when selecting a stock. I have found that adding the argument on_delete=models.CASCADE to the proper variables in models.py to fix this in other django projects.

Environment:

Request Method: POST Request URL: http://127.0.0.1:8000/portfolio

Django Version: 1.8.4 Python Version: 3.5.2 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'LoginFolio', 'StockFolio', 'compressor', 'django.contrib.humanize'] Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware')

Traceback: File "C:\Users\matt\Desktop\Prog\PyFolio\env\lib\site-packages\django\core\handlers\base.py" in get_response 132. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\matt\Desktop\Prog\PyFolio\env\lib\site-packages\django\contrib\auth\decorators.py" in _wrapped_view 22. return view_func(request, *args, **kwargs) File "C:\Users\matt\Desktop\Prog\PyFolio\StockFolio\views.py" in portfolio 30. return render(request, 'StockFolio/portfolio.html', {'stock':get_current_info([''+symbol]), 'news' : get_news_feed(symbol), 'portfolio' : porfolio, 'portfolio_rows' : plot(user_id), 'symbols' : json.dumps(STOCK_SYMBOLS), 'money' : money}) File "C:\Users\matt\Desktop\Prog\PyFolio\lib\yahoo_stock_scraper\stockretriever.py" in get_current_info 65. return __validate_response(response, 'quote') File "C:\Users\matt\Desktop\Prog\PyFolio\lib\yahoo_stock_scraper\stockretriever.py" in __validate_response 47. if __is_valid_response(response, tagToCheck): File "C:\Users\matt\Desktop\Prog\PyFolio\lib\yahoo_stock_scraper\stockretriever.py" in __is_valid_response 43. and field in response['query']['results']

Exception Type: TypeError at /portfolio Exception Value: argument of type 'NoneType' is not iterable

Rhodesware avatar Mar 26 '18 08:03 Rhodesware