coddingtonbear / django-measurement

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

Cannot serialize: Mass(kg=80) when making migrations #104

Closed kb1900 closed 3 years ago

kb1900 commented 3 years ago

Model: ` from measurement.measures import Weight

goal_weight = MeasurementField(measurement=Weight, null=True, blank=True, default=Weight(kg=80)) `

python manage.py makemigrations: ValueError: Cannot serialize: Mass(kg=80.0) There are some values Django cannot serialize into migration files. For more, see https://docs.djangoproject.com/en/3.1/topics/migrations/#migration-serializing

using django-measurement version 3.2.3, measurement version 3.2.0, django version 3.1.3

kb1900 commented 3 years ago

https://github.com/coddingtonbear/django-measurement/issues/88 may be relevant here

thanks in advance for any help!

codingjoe commented 3 years ago

Hi @kb1900, yes, it's the same issue as #88. I still haven't found the time to fix it myself. You are welcome to contribute a patch yourself. Best, Joe