When I navigate to my first view, the GET request is saved as a session variable.
def index(request):
if request.method == 'GET':
symbol = request.GET.get('symbol', 'none')
request.session['symbol'] = symbol
return render(request, 'backtests/yieldcurve.html', {'symbol' : symbol})
Then, when I navigate to another page via the sidebar, the GET request still shows up.
def yieldcurve(request):
symbol = request.session.get('symbol', 'none')
return render(request, 'backtests/yieldcurve.html', {'symbol' : symbol})
Yet, when I navigate back to the index from the sidebar, the GET request is not saved. Is there a way to do this? Thanks!
I figured it out...
def index(request):
if 'symbol' in request.GET:
symbol = request.GET.get('symbol','Invalid Symbol')
request.session['symbol'] = symbol
else:
symbol = request.session['symbol']