Skip to content

Commit 564f40b

Browse files
committed
fix missing import
1 parent bb2ce49 commit 564f40b

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

django_enum/forms.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ def _coerce(self, value: Any) -> Union[Choices, Any]:
116116
Attempt conversion of value to an enumeration value and return it
117117
if successful.
118118
119-
:param value The value to convert
120-
:return An enumeration value or the canonical empty value if value is
119+
:param value: The value to convert
120+
:raises ValidationError: if a valid return value cannot be determined.
121+
:return: An enumeration value or the canonical empty value if value is
121122
one of our empty_values, or the value itself if this is a
122123
non-strict field and the value is of a matching primitive type
123-
:raises ValidationError if a valid return value cannot be determined.
124124
"""
125125

126126
if value in self.empty_values:

django_enum/tests/tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from django.test import Client, TestCase
1313
from django.urls import reverse
1414
from django_enum import TextChoices
15+
from django_enum.forms import EnumChoiceField
1516
from django_enum.tests.djenum.enums import (
1617
BigIntEnum,
1718
BigPosIntEnum,

doc/source/usage.rst

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ data where no ``Enum`` type coercion is possible.
6464

6565
Setting this parameter to ``False`` will turn off the automatic conversion to
6666
the field's ``Enum`` type while leaving all validation checks in place. It will
67-
still be possible to set the field directly as an ``Enum`` instance:
67+
still be possible to set the field directly as an ``Enum`` instance and to
68+
filter by ``Enum`` instance or any symmetric value:
6869

6970
.. code-block:: python
7071
@@ -154,6 +155,7 @@ Filtering
154155
#########
155156

156157

158+
157159
Migrations
158160
##########
159161

@@ -179,19 +181,13 @@ Performance
179181
The cost to resolve a raw database value into an ``Enum`` type object is
180182
non-zero. ``EnumFields`` may not be appropriate for use cases at the edge of
181183
critical performance boundaries, but for most scenarios the cost of using
182-
``EnumFields`` will be negligible.
184+
``EnumFields`` is negligible.
183185

184186
An effort is made to characterize and monitor the performance penalty of
185187
using ``EnumFields`` over a Django_ native field with choices and integration
186188
tests assure performance of future releases will not worsen.
187189

188-
For model object creation ``EnumFields`` tend to be about 10% slower than an
189-
equivalent field with choices and for model object iteration ``EnumFields``
190-
tend to be about 50% slower.
191-
192-
..
193-
.. note::
194-
195-
The performance penalty can be eliminated by setting ``coerce`` to
196-
``False``.
190+
.. note::
197191

192+
The read performance penalty can be eliminated by setting ``coerce`` to
193+
``False``.

0 commit comments

Comments
 (0)