Skip to content

Commit

Permalink
Merge pull request #31 from ikseek/master
Browse files Browse the repository at this point in the history
Fix wrong mixin type for DecimalQuantityFormField
  • Loading branch information
CarliJoy committed Jun 6, 2021
2 parents 2729c98 + 27ae4f5 commit b7e5fa7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Expand Up @@ -8,3 +8,4 @@ Contributors
* Cornel Vaideanu <cornel.vaideanu@gmail.com>
* Alex Bhandari <alexbhandari@gmail.com>
* Jonas Haag <jonas@lophus.org>
* Igor Kozyrenko <igor@ikseek.com>
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -2,6 +2,11 @@
Changelog
=========

Version 0.6.1
=============
- Fix wrong mixin type for DecimalQuantityFormField (`merge request #31 from ikseek`_)


Version 0.6
===========
- Added ``DecimalQuantityField``
Expand Down Expand Up @@ -35,4 +40,5 @@ Version 0.4
.. _Carli* Freudenberg: https://github.com/CarliJoy
.. _merge request #11 from jonashaag: https://github.com/CarliJoy/django-pint/pull/11
.. _merge request #5 from cornelv: https://github.com/CarliJoy/django-pint/pull/5
.. _merge request #31 from ikseek: https://github.com/CarliJoy/django-pint/pull/31
.. _black: https://github.com/psf/black
2 changes: 1 addition & 1 deletion src/quantityfield/fields.py
Expand Up @@ -271,7 +271,7 @@ class BigIntegerQuantityField(QuantityFieldMixin, models.BigIntegerField):
to_number_type = staticmethod(raise_precision_error_on_imprecise_int)


class DecimalQuantityFormField(QuantityFieldMixin, forms.DecimalField):
class DecimalQuantityFormField(QuantityFormFieldMixin, forms.DecimalField):
to_number_type = staticmethod(Decimal)


Expand Down
8 changes: 6 additions & 2 deletions tests/test_integration.py
Expand Up @@ -5,7 +5,11 @@

from decimal import Decimal

from quantityfield.fields import IntegerQuantityFormField, QuantityFormField
from quantityfield.fields import (
DecimalQuantityFormField,
IntegerQuantityFormField,
QuantityFormField,
)
from tests.dummyapp.models import (
BigIntFieldSaveModel,
DecimalFieldSaveModel,
Expand Down Expand Up @@ -39,7 +43,7 @@ class Meta:


class DefaultFormDecimal(forms.ModelForm):
weight = QuantityFormField(base_units="gram", unit_choices=["ounce", "gram"])
weight = DecimalQuantityFormField(base_units="gram", unit_choices=["ounce", "gram"])

class Meta:
model = DecimalFieldSaveModel
Expand Down

0 comments on commit b7e5fa7

Please sign in to comment.