Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. Exception Type: TypeError at /world/market/
  2. Exception Value: list indices must be integers, not str
  3.  
  4. Environment:
  5. Request Method: GET
  6. Request URL: http://127.0.0.1:8000/world/market/
  7. Django Version: 1.6.5
  8. Python Version: 2.7.7
  9.  
  10. Installed Applications:
  11. ('django.contrib.admin',
  12. 'django.contrib.auth',
  13. 'django.contrib.contenttypes',
  14. 'django.contrib.sessions',
  15. 'django.contrib.messages',
  16. 'django.contrib.staticfiles',
  17. 'chartit',
  18. 'crispy_forms',
  19. 'south',
  20. 'agents',
  21. 'licensemarket',
  22. 'world')
  23.  
  24. Installed Middleware:
  25. ('django.contrib.sessions.middleware.SessionMiddleware',
  26. 'django.middleware.common.CommonMiddleware',
  27. 'django.middleware.csrf.CsrfViewMiddleware',
  28. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  29. 'django.contrib.messages.middleware.MessageMiddleware',
  30. 'django.middleware.clickjacking.XFrameOptionsMiddleware')
  31.  
  32. Traceback:
  33. File "C:Python27libsite-packagesdjangocorehandlersbase.py" in get_response
  34. 112. response = wrapped_callback(request, *callback_args, **callback_kwargs)
  35. File "C:Python27libsite-packagesdjangoviewsgenericbase.py" in view
  36. 69. return self.dispatch(request, *args, **kwargs)
  37. File "C:Python27libsite-packagesbracesviews_access.py" in dispatch
  38. 64. request, *args, **kwargs)
  39. File "C:Python27libsite-packagesdjangoviewsgenericbase.py" in dispatch
  40. 87. return handler(request, *args, **kwargs)
  41. File "C:Python27libsite-packagesdjangoviewsgenericbase.py" in get
  42. 154. context = self.get_context_data(**kwargs)
  43. File "V:OCTOBITOCTO ProjectsAnalystIP Exchangeexchangeworldviews.py" in get_context_data
  44. 88. 'opposite': True}]
  45. File "C:Python27libsite-packageschartitcharts.py" in __init__
  46. 295. self.generate_plot()
  47. File "C:Python27libsite-packageschartitcharts.py" in generate_plot
  48. 345. self.datasource.cv]
  49.  
  50. class MarketInfoView(
  51. views.LoginRequiredMixin,
  52. generic.TemplateView
  53. ):
  54. model = models.WorldHistory
  55.  
  56. template_name = "world/market.html"
  57.  
  58. def get_context_data(self):
  59.  
  60. # In this method we create the chart and
  61. # send to template so that it can be loaded
  62. marketdata = PivotDataPool(
  63. series= [
  64. {'options':{
  65. 'source': AgentPerformance.objects.filter(
  66. world=models.World.objects.last()),
  67. 'categories': 'period',
  68. 'legend_by': 'agent_name'},
  69. 'terms': {
  70. 'tot_prod':Sum('units_produced')
  71. ,'market_price':{
  72. 'func': Max('price'),
  73. 'legend_by': None}
  74. }},
  75. ],
  76. # sortf_mapf_mts = (None,self.per_name,False)
  77. )
  78.  
  79. pivcht = PivotChart(
  80. datasource = marketdata,
  81. series_options = [
  82. {'options': {
  83. 'type': 'column',
  84. 'stacking': True,
  85. 'xAxis': 0,
  86. 'yAxis': 0,
  87. 'zAxis': 0},
  88. 'terms': [
  89. 'tot_prod'
  90. ,
  91. {'market_price': {
  92. 'type': 'line',
  93. 'stacking': False,
  94. 'yAxis': 1,
  95. 'zAxis': 1}}
  96. ]}],
  97. chart_options = {
  98. 'title': {
  99. 'text': 'Historical Market Production and Price'},
  100. 'xAxis': [{
  101. 'title': {
  102. 'text': 'Period'}
  103. }],
  104. 'yAxis': [{
  105. 'title': {
  106. 'text': 'Units Produced'}
  107. }, {
  108. 'title': {
  109. 'text': 'Market Price'},
  110. 'opposite': True}]
  111. }
  112. )
  113.  
  114. return {'marketchart': pivcht}
  115.  
  116. <head>
  117. <script src="http://code.jquery.com/jquery-latest.min.js"></script>
  118. <script src="http://code.highcharts.com/highcharts.js"></script>
  119. {% load chartit %}
  120. {{ marketchart|load_charts:"container" }}
  121. </head>
  122. <body>
  123. <div id='container'>Chart goes here</div>
  124. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement