This package provides a custom field to make use of the Unit class provided by pint https://pypi.org/project/Pint/
Original idea is from https://github.com/bharling/django-pint but in this package the amount is also stored.
** NOT SUITED FOR PRODUCTION ** This is a WIP, and it has not been tested properly.
git clone git@github.com:marcosalcazar/django-pint-unit-field.git
Add the field to your models
from pintunitfield.fields import PintUnitField
class TheClass(models.Model):
attribute = PintUnitField() # max_length is optional, 50 is de default value
** Inside virtualenv **
pip install -r test_requirements.txt
python runtests.py