Re: Request works with sqlite not with Postgres

2016-04-04 Thread Simon Charette
Hi Tazo, I just submitted a patch that correctly resolves the `output_field` of `Avg` over non-numeric fields. If it gets merged you shouldn't have to worry about passing an explicit `output_field=DurationField()` in Django 1.10. Simon Le lundi 4 avril 2016 09:46:53 UTC-4, Tazo Gil a écrit : >

Re: Request works with sqlite not with Postgres

2016-04-04 Thread Tazo Gil
Without your help, I would not get the solution. Maybe the doc (https://docs.djangoproject.com/en/1.9/ref/models/querysets/#avg) should be more precise about this case. Merci beaucoup Le lundi 4 avril 2016 05:35:14 UTC+2, Simon Charette a écrit : > > Hi Tazo, > > The default `output_field` of t

Re: Request works with sqlite not with Postgres

2016-04-03 Thread Simon Charette
Hi Tazo, The default `output_field` of the `Avg` aggregate is a `FloatField`[1] hence the error raised here. In the case of SQLite, `DurationField`s are stored as large integers of microseconds[2] and the result returned by the database is already a float making `float(value)` a no-op in `convert_

Re: Request works with sqlite not with Postgres

2016-04-02 Thread Tazo Gil
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: >>> > Questionn

Request works with sqlite not with Postgres

2016-04-02 Thread Tazo Gil
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 "", li