django-pint
django-pint copied to clipboard
Simple django app for storing Quantities with units, leveraging the Pint library
```python class QuantityWidget(MultiWidget): def __init__(self, *, attrs=None, base_units=None, allowed_types=None): self.ureg = ureg choices = self.get_choices(allowed_types) self.base_units = base_units attrs = attrs or {} attrs.setdefault("step", "any") ### LOOK HERE widgets =...
Pseudocode ```python class QuantityWidget(QuantityFormField) def __init__(base_units=, allowed_types=) ``` whereas: ```python class QuantityField def __init__(base_units=, unit_choices=) ``` semantically `allowed_types` and `unit_choices` are the same thing but are referenced with different names,...