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
Close
Hashes for django-enumchoicefield-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6622645005facbab19f31b77a43c4582f69cc77a1c2e6d6c226ff0c2b18218d |
|
MD5 | 44c4d06d9c1d101874358997515d2ec6 |
|
BLAKE2b-256 | be0ec391344f12b9e68b6793cd4e633144905b500aaaa916cb5d812e70e48188 |
Close
Hashes for django_enumchoicefield-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3dee8eaf80df188804bbb6bc64ed783225b091425798f6dfb292ddb36b64d58 |
|
MD5 | e24452cc0fe3ac1a671e061cdd73f5d6 |
|
BLAKE2b-256 | 8613b0b4b39c3a380c6d9f86cc10861f6804deb1706b3bd5983e007c25e0bbc4 |