I forgot to precise the type of the  field Chrono.temps: 
temps = models.DurationField(null=True)

Le samedi 2 avril 2016 19:08:20 UTC+2, Tazo Gil a écrit :
>
> Hello,
>
> The following request works in my dev django project (sqlite) by not in 
> production with postgres 
>
> out: >>> 
> Questionnaire.objects.filter(site_id=1).annotate(moyenne=Avg('chrono__temps')).values('title','moyenne')
>
> The errors : 
>
>  out: Traceback (most recent call last):
>  out:   File "<console>", line 1, in <module>
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
>  
> line 234, in __repr__
>  out:     data = list(self[:REPR_OUTPUT_SIZE + 1])
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
>  
> line 258, in __iter__
>  out:     self._fetch_all()
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
>  
> line 1074, in _fetch_all
>  out:     self._result_cache = list(self.iterator())
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
>  
> line 112, in __iter__
>  out:     for row in compiler.results_iter():
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
>  
> line 808, in results_iter
>  out:     row = self.apply_converters(row, converters)
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
>  
> line 792, in apply_converters
>  out:     value = converter(value, expression, self.connection, 
> self.query.context)
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/expressions.py",
>  
> line 283, in convert_value
>  out:     return float(value)
>  out: TypeError: float() argument must be a string or a number
>
> Thank you for your help.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2aa47b20-408b-474e-baca-c15b3c0dcfe1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to