【发布时间】:2015-05-22 20:17:47
【问题描述】:
我有这个函数视图。
如何在基于类的视图中转换这个函数?
在这种情况下,我使用 TemplateView?
def linechart(request):
ds = DataPool(
series=[{'options': {
'source': MonthlyWeatherByCity.objects.all()},
'terms': [
'month',
'houston_temp',
'boston_temp']}
])
cht = Chart(
datasource=ds,
series_options=[{'options': {
'type': 'bar',
'stacking': False},
'terms': {
'month': [
'boston_temp',
'houston_temp']
}}],
chart_options={'title': {
'text': 'Weather Data of Boston and Houston'},
'xAxis': {
'title': {
'text': 'Month number'}}})
return render_to_response('core/linechart.html', {'weatherchart': cht})
返回错误
【问题讨论】:
-
有一天有人会因为这种代码格式化而杀了你
标签: django function charts django-generic-views