Django-Chartitのドキュメントで提供されているモデルとサンプルを使用して、django-chartitを使用してページをレンダリングしようとしています。Django-Chart円形リクエストエラー
私のモデルはこのように見えます。
class MonthlySchedule(models.Model):
''' Monthly schedule for django-chartit statistics'''
months = (
(u'jan',_('January')),
(u'feb',_('February')),
(u'mar',_('March')),
(u'apr',_('April')),
(u'may',_('May')),
(u'jun',_('June')),
(u'jul',_('July')),
(u'aug',_('August')),
(u'sep',_('September')),
(u'oct',_('October')),
(u'nov',_('November')),
(u'dec',_('December'))
)
programme = models.ForeignKey(Redaktion, related_name='red_monthly', null=True, on_delete=models.CASCADE)
year = models.CharField(_('Year'), max_length=4, blank=False, default=year)
month = models.CharField(_('Month'), choices=months, max_length=3)
current_size = models.DecimalField(_('Current size(TB)'), max_digits=4, decimal_places=1, blank=True, null=True)
target_size = models.DecimalField(_('Target size(TB)'), max_digits=4, decimal_places=1, blank=True, null=True)
def __str__(self):
return ''
class Meta:
verbose_name = (_("quota"))
verbose_name_plural = (_("quotas"))
と私の見解は次のようになり...
@staff_member_required
def ChartitSchedule(request, red=None):
'''Monthly disk Quotas'''
ds = DataPool(
series=[{
'options': {
'source': MonthlySchedule.objects.filter(programme__pk=red)
},
'terms': [
'month',
{'Current Size': 'current_size'},
'target_size'
]
}]
)
cht = Chart(
datasource=ds,
series_options=[{
'options': {
'type': 'line',
'stacking': False
},
'terms': {
'month': [
'target_size',
'Current Size'
]
}
}],
chart_options={
'title': {
'text': 'Disk Quotas'
},
'xAxis': {
'title': {
'text': 'Month'
}
}
})
return render(request, 'sysadmin/chartit.html', {'this_chart': True, 'these_quotas':cht})
と私のテンプレートは次のようになります....
{% extends 'base2.html' %}
{% block title %}Programme Quotas{% endblock %}
{% load static %}
{% block add_to_header %}
{% load chartit %}
{{ these_quotas|load_charts:"container" }}
{% endblock %}
{% block content %}
<!-- CHART-IT -->
{% if this_chart %}
<div id="pagetitle">Disk Quotas {{ red }}</div>
<div id="content"><!-- CONTENT -->
<div id='container'></div>
</div><!-- CONTENT -->
{% endif%}
{% endblock content %}
これはかなりの例と同じです(私が彼らがアルファベットを分類すると思う悪い考えである)月のための選択を使用していることを除いて、ドキュメント。
ビューは2つのchartitオブジェクトを返し、jsonはokのように見えます。 C:私は取得
エラーが例外場所「検出循環参照」です\ python35 \ Libの\ JSON \ encoder.py iterencodeで、私は考えて私の手からはかなりあるライン256
- または私は間違って何かをしていますか?