Skip to main content

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
        )

Project details


Download files

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

Source Distribution

django-enums-0.1.8.tar.gz (6.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

django_enums-0.1.8-py2.7.egg (23.0 kB view details)

Uploaded Egg

django-enums-0.1.8.linux-x86_64.tar.gz (12.2 kB view details)

Uploaded Source

File details

Details for the file django-enums-0.1.8.tar.gz.

File metadata

  • Download URL: django-enums-0.1.8.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-enums-0.1.8.tar.gz
Algorithm Hash digest
SHA256 b811b3b6bfb3122d312374334997a6d1f1e3230d41bd7a2cb1ea81d8fdcb77a5
MD5 8801ddc90b52e96d98f1a6a0921b0bf1
BLAKE2b-256 44faff93b693a00ba5896ccfc4f39e9a41f3778392c52240aced2831515ffb50

See more details on using hashes here.

File details

Details for the file django_enums-0.1.8-py2.7.egg.

File metadata

File hashes

Hashes for django_enums-0.1.8-py2.7.egg
Algorithm Hash digest
SHA256 7da2730655ba24bf4b07ea7b9f02856592f0c3411be0e2570452cf9c520ce524
MD5 0044601be393cb93800341dadb0320b2
BLAKE2b-256 39ae9bc8d16725ab325e6f356b6a65fc819ff1a274516419cb3baf185f0f9552

See more details on using hashes here.

File details

Details for the file django-enums-0.1.8.linux-x86_64.tar.gz.

File metadata

File hashes

Hashes for django-enums-0.1.8.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 31bf1015db25f0d14b682126d36a3b2599504bc3443f2513f8c2741ab5cef0ee
MD5 13362547764520efd724cbafcf351cb6
BLAKE2b-256 d30a4930f8cc8c449f3f91aaa6751ece13fff1bb843383b9031e52239ba47ae6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page