Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/04/2016, 08:47
sarayo2
 
Fecha de Ingreso: noviembre-2015
Mensajes: 9
Antigüedad: 8 años, 6 meses
Puntos: 0
Error cannot concatenate 'str' and 'dict' objects al utilizar chartit de django

Hola amigos,

Estoy intentando utilizar chartit para hacer gráficos en django. Tengo definido lo siguiente:

models.py
class datos_extraidos(models.Model):

id_serie = models.IntegerField(primary_key=True)
clave = models.IntegerField()
valor = models.IntegerField()
subclave = models.CharField(max_length=8)

class Meta:
db_table = u'datos_extraidos'

views.py
def graficas(request):
try:
bd = MySQLdb.connect("localhost","root","","gestion")
cursor = bd.cursor(MySQLdb.cursors.DictCursor)
cursor = bd.cursor()
cursor.execute("CALL gestion.dofp_muestra_datos_semanales(16)")
resultado = cursor.fetchall()
cursor.close()


ds = DataPool(series=[{'options': {'source': datos_extraidos.objects.filter(id_serie=63)}, 'terms': ['clave', 'valor']}])
cht = Chart(datasource=ds, series_options = [{'options':{'type':'line', 'stacking': False }, 'terms':{'clave': ['valor']}}], chart_options = {'title': {'text': 'Datos arrojados'},'xAxis': {'title': {'text': 'Semanas'}}})

except MySQLdb.Error, e:
print "Mysql Error %d: %s" % (e.args[0], e.args[1])


return render_to_response({'weatherchart': cht})

table.html
{% extends "bootstrap/layouts/12.html" %}

{% load django_tables2 %}
{% load chartit %}
{{ weatherchart|load_charts:"container" }}
{% block all %}


<script src="{{STATIC_URL}}js/perfilado/utils.js" ></script>
<script src="{{STATIC_URL}}js/perfilado/utils_UOBase.js" ></script>
<script type="text/javascript" src="{{STATIC_URL}}js/jquery-latest.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/jquery.tablesorter.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/highcharts/js/highcharts.js"></script>

<body>
<div id='container'> Chart will be rendered here </div>
</body>


El error que me está arrojando es: cannot concatenate 'str' and 'dict' objects

Alguien sabe que puede estar sucediendo?
Muchas gracias,