Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A simple Enum class and EnumField for Django models.

Project description

django-enums is a simple Enum class and EnumField for Django models. Enum class inherits Enum class in the default enum module. EnumFiled class inherits Charfield.


>>> pip install django-enums


Inherit Enum class and set it to EnumField.enum.:

from django.db import models
from django_enums import enum

class MyEnum(enum.Enum):

    __order__ = 'FOO BAR FOOBAR' # for python 2

    FOO = ('f', 'Foo')
    BAR = ('b', 'Bar')
    FOOBAR = ('fb', 'FooBar')

class MyModel(models.Model):

    enum_field = enum.EnumField(
        MyEnum, # required
        default=MyEnum.FOO, # optional

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-enums-0.1.9.linux-x86_64.tar.gz (12.3 kB) Copy SHA256 hash SHA256 Source None Feb 20, 2017
django_enums-0.1.9-py2.7.egg (23.1 kB) Copy SHA256 hash SHA256 Egg 2.7 Feb 20, 2017
django_enums-0.1.9-py2-none-any.whl (18.7 kB) Copy SHA256 hash SHA256 Wheel py2 Feb 20, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page