Skip to main content

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

See Django EnumChoiceField on ReadTheDocs.

Testing

To run the tests:

$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements-dev.txt
$ tox

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-enumchoicefield-0.9.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

django_enumchoicefield-0.9.0-py2.py3-none-any.whl (12.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-enumchoicefield-0.9.0.tar.gz.

File metadata

File hashes

Hashes for django-enumchoicefield-0.9.0.tar.gz
Algorithm Hash digest
SHA256 1db7d3b6d1b89ec007ed264aeb0ee658e14b80d0fa8392900c90021ae058cc1f
MD5 4e13b68a06bdf8389b42ee5d6271ade1
BLAKE2b-256 4dd0c06fee93e7156e3893002c132cd19ce76e2351776ead52a5e158f1de57f5

See more details on using hashes here.

File details

Details for the file django_enumchoicefield-0.9.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_enumchoicefield-0.9.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ae1ec746565403e352f9725f61ad459924dd5e6dbce2ec53ada860952b1c4d70
MD5 4882337ba437d588fb790a3191a51c81
BLAKE2b-256 8391f691918f1abd848f3b2902e98784b295c4be957681fc3c4d4870e2e03740

See more details on using hashes here.

Supported by

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