CarliJoy / django-pint

Simple django app for storing Quantities with units, leveraging the Pint library
https://django-pint.readthedocs.io
MIT License
39 stars 16 forks source link

conversion to base #58

Closed mikeford3 closed 1 year ago

mikeford3 commented 2 years ago

Hi @CarliJoy

Is the conversion to base units in the database necessary for Pint etc, or could it be made optional?

In some cases I'd like for users to be able to enter data in SI or US units and then have them displayed in update or detail views etc, but using the same units rather than automatic conversion to base.

Thanks

CarliJoy commented 2 years ago

Its impossible. You would need to store the information which unit was used somewhere. That is not easily possible with the given django model as you would need two database fields that represent one django model field.

Something I explained already in https://github.com/CarliJoy/django-pint/issues/38#issuecomment-1137018967

CarliJoy commented 1 year ago

Duplicate of #38

Handling everything related there.