Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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.

Installation

>>> pip install django-enums

Usage

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
        )
Release History

Release History

This version
History Node

0.1.9

History Node

0.1.8

History Node

0.1.7

History Node

0.1.6

History Node

0.1.5

History Node

0.1.4

History Node

0.1.3

History Node

0.1.2

History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-enums-0.1.9.linux-x86_64.tar.gz (12.3 kB) Copy SHA256 Checksum SHA256 Source Feb 20, 2017
django_enums-0.1.9-py2.7.egg (23.1 kB) Copy SHA256 Checksum SHA256 2.7 Egg Feb 20, 2017
django_enums-0.1.9-py2-none-any.whl (18.7 kB) Copy SHA256 Checksum SHA256 py2 Wheel Feb 20, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting