在views.py,我将时间序列数据存储在字典中,如下所示:
time_series = {"timestamp1": occurrences, "timestamp2": occurrences}
Run Code Online (Sandbox Code Playgroud)
其中每个timestamp都在unix时间并且occurrences是一个整数.
有没有办法在时间render函数的上下文中将时间序列数据作为json对象传递?
为什么这样做:我在前端使用Cal-heatmap,要求数据采用json格式.Ajax请求现在工作得很好,但我理想的是希望尽可能使用这种render方法.