#26215: if dumpdata FloatRangeField and IntegerRangeField values = "None" and 
post
loaddata is ValidationError
----------------------------------------------+--------------------
     Reporter:  bukin242                      |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.9
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 1. FloatRangeField db data == None
 2. ./manage dumpdata
 3. ./manage loaddata

 Conversion problem. accept string u'None' to float type

 Track:
   File "/local/lib/python2.7/site-
 packages/django/db/models/fields/__init__.py", line 1803, in to_python
     params={'value': value},

 Decision:

 {{{

     def to_python(self, value):
         if value == u'None':
             return None
         elif value is None:
             return value
         try:
             return int(value)
         except (TypeError, ValueError):
             raise exceptions.ValidationError(
                 self.error_messages['invalid'],
                 code='invalid',
                 params={'value': value},
             )
 }}}

 And IntegerField too

 Source data dump example:

 {{{
 <field name="rate" type="FloatRangeField">{"upper": "None", "lower":
 "1.45", "bounds": "[)"}</field>
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26215>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.399773ebf7c2553c2881abeb32cf9932%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to