coddingtonbear / django-measurement

Easily store, retrieve, and convert measurements of weight, volume, distance, area and more.
MIT License
145 stars 33 forks source link

Cannot deserialize measurement fields #91

Closed NyanKiyoshi closed 4 years ago

NyanKiyoshi commented 4 years ago

Steps

  1. Having a model with measurement data
  2. Exporting the database data using ./manage.py dumpdata [app[.model]] -o output.json
  3. Loading the fixture data back into the database using ./manage.py loaddata output.json

Error Stack

  File "python3.7/site-packages/django/core/management/commands/loaddata.py", line 72, in handle
    self.loaddata(fixture_labels)
  File "python3.7/site-packages/django/core/management/commands/loaddata.py", line 114, in loaddata
    self.load_label(fixture_label)
  File "python3.7/site-packages/django/core/management/commands/loaddata.py", line 172, in load_label
    for obj in objects:
  File "python3.7/site-packages/django/core/serializers/json.py", line 69, in Deserializer
    yield from PythonDeserializer(objects, **options)
  File "python3.7/site-packages/django/core/serializers/python.py", line 145, in Deserializer
    raise base.DeserializationError.WithData(e, d['model'], d.get('pk'), field_value)
django.core.serializers.base.DeserializationError: Problem installing fixture 'dump.json': ["'1.0 kg' value must be a float."]: (myapp.mymodel:pk=7) field_value was '1.0 kg'