Ticket #10932: aggregations_postgresql_allow_charfields.diff

File aggregations_postgresql_allow_charfields.diff, 700 bytes (added by Guillermo Gutiérrez, 16 years ago)

wraps try/except around float(value) on convert_value

  • django/db/backends/__init__.py

     
    440440            return value
    441441        # No field, or the field isn't known to be a decimal or integer
    442442        # Default to a float
    443         return float(value)
     443        try:                       #3566: try float ...
     444            return float(value)
     445        except ValueError:         #3566: ... then allow strings
     446            return value
    444447
    445448    def check_aggregate_support(self, aggregate_func):
    446449        """Check that the backend supports the provided aggregate
Back to Top