A choice field for Django using native Python Enums
Project description
A Django model field for native Python 3.4 Enums.
from enumchoicefield import ChoiceEnum, EnumChoiceField
class Fruit(ChoiceEnum):
apple = "Apple"
banana = "Banana"
orange = "Orange"
class Profile(models.Model):
name = models.CharField(max_length=100)
favourite_fruit = EnumChoiceField(Fruit, default=Fruit.banana)
Documentation
Testing
To run the tests:
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements-dev.txt
$ tox
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-enumchoicefield-1.1.0.tar.gz.
File metadata
- Download URL: django-enumchoicefield-1.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6df41949a774296859fbe2a55be0caf7ef08500d1a5d2e73621e4283a7204036
|
|
| MD5 |
57011f42b2c58f34b4cf9d335fa662fe
|
|
| BLAKE2b-256 |
c71ec4e4d9e9acf88020cdd1af21b7fb187f5ae51c05e72d940dc27134963797
|
File details
Details for the file django_enumchoicefield-1.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: django_enumchoicefield-1.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a94c2ceb26ea0eb4bdf35b524fbd2335d27c44a43d25e7e3518943f23b2752f0
|
|
| MD5 |
25b883948de33ae34238bd3407a9d45a
|
|
| BLAKE2b-256 |
ab683e28a5ccb79b6508d42cf15c49294ddfd787d5529c085637f308275754b5
|