下午好..我有一个这样的模型:
class Reportage:
def get_num(self):
end_date = self.date.end_date
start_date = self.date.start_date
duration = time.mktime(end_date.timetuple()) - time.mktime(start_date.timetuple())
delta_t = duration / 60
num = []
for t in range(0,duration,delta_t):
start = t + start_date
end = datetime.timedelta(0,t+delta_t) + start_date
n_num = self.get_num_in_interval(start,end)
num.append([t, n_num])
return num
我想用simplejson序列化num []
views.py中的数组,以便在第二时刻将此数组传递给jquery脚本以将其绘制在图中..序列化该数组的代码是什么..?我希望我很清楚..提前感谢所有回复的人..