Re: [Django] #19448: BaseDatabaseFeatures convert_values

2012-12-09 Thread Django
#19448: BaseDatabaseFeatures convert_values
-+-
 Reporter:  anton.nagornyi@… |Owner:  nobody
 Type:   |   Status:  closed
  Cleanup/optimization   |  Version:  1.4
Component:  Core (Other) |   Resolution:  duplicate
 Severity:  Normal   | Triage Stage:
 Keywords:  convert_values   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by apollo13):

 * status:  new => closed
 * needs_docs:   => 0
 * resolution:   => duplicate
 * needs_tests:   => 0
 * needs_better_patch:   => 0


Comment:

 This is a duplicate of the already fixed ticket #13844 (will be in 1.5)

-- 
Ticket URL: 
Django 
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.




[Django] #19448: BaseDatabaseFeatures convert_values

2012-12-09 Thread Django
#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: 
Django 
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.