Skip to content

Commit 518bf61

Browse files
committed
attempt to fix import problem on missing dependencies
1 parent 03a81f6 commit 518bf61

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

django_enum/choices.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -83,29 +83,32 @@ class DjangoEnumPropertiesMeta(ChoicesMeta): # type: ignore
8383
Needs to be strict subclass of same metaclass as Enum to make it to
8484
the ImportError.
8585
"""
86-
def __new__(mcs, *args, **kwargs): # pylint: disable=W0231
86+
def __init__(self, *args, **kwargs): # pylint: disable=W0231
8787
raise ImportError(
88-
f'{mcs.__name__} requires enum-properties to be '
88+
f'{self.__class__.__name__} requires enum-properties to be '
8989
f'installed.'
9090
)
9191

9292
class TextChoices( # type: ignore
9393
DjangoSymmetricMixin,
9494
str,
95-
Choices
95+
Choices,
96+
metaclass=ChoicesMeta
9697
):
9798
"""Raises ImportError on class definition"""
9899

99100
class IntegerChoices( # type: ignore
100101
DjangoSymmetricMixin,
101102
int,
102-
Choices
103+
Choices,
104+
metaclass=ChoicesMeta
103105
):
104106
"""Raises ImportError on class definition"""
105107

106108
class FloatChoices( # type: ignore
107109
DjangoSymmetricMixin,
108110
float,
109-
Choices
111+
Choices,
112+
metaclass=ChoicesMeta
110113
):
111114
"""Raises ImportError on class definition"""

0 commit comments

Comments
 (0)