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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
django_enums-0.1.9-py2.7.egg
(23.1 kB
view details)
File details
Details for the file django-enums-0.1.9.linux-x86_64.tar.gz
.
File metadata
- Download URL: django-enums-0.1.9.linux-x86_64.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a0246ce2b5ee3620d0989fd2701e2a6efc7299e97994c1858b5ddb02283c2bd |
|
MD5 | f6662282fa7e8ecb382b190942b9c6f1 |
|
BLAKE2b-256 | 285bfcb0da3a68e13544951cb62b71ea586c1aa35c6358db78ef9c74ef08fef7 |
File details
Details for the file django_enums-0.1.9-py2.7.egg
.
File metadata
- Download URL: django_enums-0.1.9-py2.7.egg
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1a9ffae4e720ea340d5e84fc4b5e369fe49d58a7557b68157b1d9d834e6d052 |
|
MD5 | d01b65d9342037bbc4c48f2ccfec4f1d |
|
BLAKE2b-256 | 37c3b0c2f4beea5a8c995d2835bb78d9ce64d3e64f5657da4427cf6be9d0e5e8 |
File details
Details for the file django_enums-0.1.9-py2-none-any.whl
.
File metadata
- Download URL: django_enums-0.1.9-py2-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d74cbbeb88f200de3e16e38715a8ebbc37b44bc7909c30b52bf22626525a5c22 |
|
MD5 | 07d7ed63383ffb898bf80930abcf0485 |
|
BLAKE2b-256 | a205186f52115c55797e0601b97c957ab6b62710a587d0721588ef99a8761548 |