Skip to content

Commit 1a06ee6

Browse files
committed
Fix deprecation warning for Django 1.8+
1 parent d352f21 commit 1a06ee6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

django_enumfield/db/fields.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1+
import django
12
from django.db import models
23
from django import forms
34
from django.utils import six
45

56
from django_enumfield import validators
67

78

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):
916
""" EnumField is a convenience field to automatically handle validation of transitions
1017
between Enum values and set field choices from the enum.
1118
EnumField(MyEnum, default=MyEnum.INITIAL)

0 commit comments

Comments
 (0)