我有一些json数据,我通过python发送到html页面。但是,当我尝试比较负数时,我发现django无法正常工作。例如,我有jsonData.5.z_score = -1.1,但在django中,以下比较并不起作用。我该怎么办?
{% if jsonData.5.z_score < -1 %}
views.py:
jsonData = ""
try:
r = requests.get(link,timeout=20)
r.text
jsonData = json.loads(r.text)
except Exception,e:
pass
except requests.exceptions.ConnectionError as e: # This is the correct syntax
pass
return utils.render_template('ui/index', { 'ACCOUNT_ID': account_id, 'SETTINGS': settings, 'jsonData':jsonData })