If value in interval is not selected, i would like to use default one ( 1d )
# if i got post request
if request.method == "POST":
# check if interval is choosen in form
if 'interval' in request.POST:
interval= request.POST["interval"]
else:
interval = "1d"
if "ticker" in request.POST:
ticker= request.POST["ticker"]
the value of intervals is not check properly if is there
CodePudding user response:
You set this default value in frontend. In your html:
<option selected="selected">
1d
</option>
I would argue that it is the better option.
You can of course check for empty string in the interval keyword
if request.POST["interval"] == "":
interval = "1d"