#19448: BaseDatabaseFeatures convert_values --------------------------------------+---------------------------- Reporter: anton.nagornyi@… | Owner: nobody Type: Cleanup/optimization | Status: new Component: Core (Other) | Version: 1.4 Severity: Normal | Keywords: convert_values Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------+---------------------------- In django.db.backends there is convert_values function. I have declared custom field which corresponds to Postgresql interval type. By default convert_values assumes that unknown type is float. Is it possible to change this behaviour? Like that (look at return):
{{{ def convert_values(self, value, field): """Coerce the value returned by the database backend into a consistent type that is compatible with the field type. """ internal_type = field.get_internal_type() if internal_type == 'DecimalField': return value elif internal_type and internal_type.endswith('IntegerField') or internal_type == 'AutoField': return int(value) elif internal_type in ('DateField', 'DateTimeField', 'TimeField'): return value # No field, or the field isn't known to be a decimal or integer # Default to a float #return float(value) #Not to a float. Just leave as is return value }}} -- Ticket URL: <https://code.djangoproject.com/ticket/19448> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.