We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d352f21 commit 1a06ee6Copy full SHA for 1a06ee6
django_enumfield/db/fields.py
@@ -1,11 +1,18 @@
1
+import django
2
from django.db import models
3
from django import forms
4
from django.utils import six
5
6
from django_enumfield import validators
7
8
-class EnumField(six.with_metaclass(models.SubfieldBase, models.IntegerField)):
9
+if django.VERSION < (1, 8):
10
+ base_class = six.with_metaclass(models.SubfieldBase, models.IntegerField)
11
+else:
12
+ base_class = models.IntegerField
13
+
14
15
+class EnumField(base_class):
16
""" EnumField is a convenience field to automatically handle validation of transitions
17
between Enum values and set field choices from the enum.
18
EnumField(MyEnum, default=MyEnum.INITIAL)
0 commit comments