Open acdha opened 11 years ago
The good news is that it looks like they changed the logic in Django 1.5 to just return the value when not sure what type it is.
I'll investigate how to fix it for older Djangos
On Feb 19, 2013, at 8:35 AM, Chris Adams notifications@github.com wrote:
The new aggregate function raises a ValueError with Django 1.4.3 and MySQL:
File "/Users/cadams/.virtualenvs/wdl/lib/python2.7/site-packages/alphafilter/templatetags/alphafilter.py", line 60, in alphabet letters_used = _get_available_letters(field_name, cl.model.objects.all()) File "/Users/cadams/.virtualenvs/wdl/lib/python2.7/site-packages/alphafilter/templatetags/alphafilter.py", line 45, in _get_available_letters return set([res['fl'] for res in result if res['fl'] is not None]) File "/Users/cadams/.virtualenvs/wdl/lib/python2.7/site-packages/django/db/models/query.py", line 118, in _result_iter self._fill_cache() File "/Users/cadams/.virtualenvs/wdl/lib/python2.7/site-packages/django/db/models/query.py", line 892, in _fill_cache self._result_cache.append(self._iter.next()) File "/Users/cadams/.virtualenvs/wdl/lib/python2.7/site-packages/django/db/models/query.py", line 962, in iterator for row in self.query.get_compiler(self.db).results_iter(): File "/Users/cadams/.virtualenvs/wdl/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 790, in results_iter ]) + tuple(row[aggregate_end:]) File "/Users/cadams/.virtualenvs/wdl/lib/python2.7/site-packages/django/db/models/sql/query.py", line 338, in resolve_aggregate return self.convert_values(value, aggregate.field, connection) File "/Users/cadams/.virtualenvs/wdl/lib/python2.7/site-packages/django/db/models/sql/query.py", line 316, in convert_values return connection.ops.convert_values(value, field) File "/Users/cadams/.virtualenvs/wdl/lib/python2.7/site-packages/django/db/backends/init.py", line 856, in convert_values return float(value) ValueError: could not convert string to float: A The underlying problem appears to be https://github.com/django/django/blob/1.4.3/django/db/models/sql/query.py#L318 which has the implicit assumption that aggregates always return numeric types or None.
— Reply to this email directly or view it on GitHub.
any updates how to support this on older django versions?
The new aggregate function raises a ValueError with Django 1.4.3 and MySQL:
The underlying problem appears to be https://github.com/django/django/blob/1.4.3/django/db/models/sql/query.py#L318 which has the implicit assumption that aggregates always return numeric types or None.