django-pint icon indicating copy to clipboard operation
django-pint copied to clipboard

pint context

Open mmarras opened this issue 7 months ago • 3 comments

Is there a(lready) way to use the QuanityField with a pint context?

An example of what I would like to do (note the units for force [Newtons] and weight [kilogram] occuring together which makes sense on earth):

class Model(models.model):
    with ureg.context('earth'):
        field = QuantityField(base_unit='N', default = ureg.Quantity(1,'kg'), unit_choices=['kN', 'ton'])

mmarras avatar Jul 30 '24 12:07 mmarras