Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Exception Type: TypeError at /world/market/
- Exception Value: list indices must be integers, not str
- Environment:
- Request Method: GET
- Request URL: http://127.0.0.1:8000/world/market/
- Django Version: 1.6.5
- Python Version: 2.7.7
- Installed Applications:
- ('django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'chartit',
- 'crispy_forms',
- 'south',
- 'agents',
- 'licensemarket',
- 'world')
- Installed Middleware:
- ('django.contrib.sessions.middleware.SessionMiddleware',
- 'django.middleware.common.CommonMiddleware',
- 'django.middleware.csrf.CsrfViewMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'django.contrib.messages.middleware.MessageMiddleware',
- 'django.middleware.clickjacking.XFrameOptionsMiddleware')
- Traceback:
- File "C:Python27libsite-packagesdjangocorehandlersbase.py" in get_response
- 112. response = wrapped_callback(request, *callback_args, **callback_kwargs)
- File "C:Python27libsite-packagesdjangoviewsgenericbase.py" in view
- 69. return self.dispatch(request, *args, **kwargs)
- File "C:Python27libsite-packagesbracesviews_access.py" in dispatch
- 64. request, *args, **kwargs)
- File "C:Python27libsite-packagesdjangoviewsgenericbase.py" in dispatch
- 87. return handler(request, *args, **kwargs)
- File "C:Python27libsite-packagesdjangoviewsgenericbase.py" in get
- 154. context = self.get_context_data(**kwargs)
- File "V:OCTOBITOCTO ProjectsAnalystIP Exchangeexchangeworldviews.py" in get_context_data
- 88. 'opposite': True}]
- File "C:Python27libsite-packageschartitcharts.py" in __init__
- 295. self.generate_plot()
- File "C:Python27libsite-packageschartitcharts.py" in generate_plot
- 345. self.datasource.cv]
- class MarketInfoView(
- views.LoginRequiredMixin,
- generic.TemplateView
- ):
- model = models.WorldHistory
- template_name = "world/market.html"
- def get_context_data(self):
- # In this method we create the chart and
- # send to template so that it can be loaded
- marketdata = PivotDataPool(
- series= [
- {'options':{
- 'source': AgentPerformance.objects.filter(
- world=models.World.objects.last()),
- 'categories': 'period',
- 'legend_by': 'agent_name'},
- 'terms': {
- 'tot_prod':Sum('units_produced')
- ,'market_price':{
- 'func': Max('price'),
- 'legend_by': None}
- }},
- ],
- # sortf_mapf_mts = (None,self.per_name,False)
- )
- pivcht = PivotChart(
- datasource = marketdata,
- series_options = [
- {'options': {
- 'type': 'column',
- 'stacking': True,
- 'xAxis': 0,
- 'yAxis': 0,
- 'zAxis': 0},
- 'terms': [
- 'tot_prod'
- ,
- {'market_price': {
- 'type': 'line',
- 'stacking': False,
- 'yAxis': 1,
- 'zAxis': 1}}
- ]}],
- chart_options = {
- 'title': {
- 'text': 'Historical Market Production and Price'},
- 'xAxis': [{
- 'title': {
- 'text': 'Period'}
- }],
- 'yAxis': [{
- 'title': {
- 'text': 'Units Produced'}
- }, {
- 'title': {
- 'text': 'Market Price'},
- 'opposite': True}]
- }
- )
- return {'marketchart': pivcht}
- <head>
- <script src="http://code.jquery.com/jquery-latest.min.js"></script>
- <script src="http://code.highcharts.com/highcharts.js"></script>
- {% load chartit %}
- {{ marketchart|load_charts:"container" }}
- </head>
- <body>
- <div id='container'>Chart goes here</div>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement