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
File details
Details for the file django-enumchoicefield-0.2.0.tar.gz
.
File metadata
- Download URL: django-enumchoicefield-0.2.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36974b1d91246d889911d0ece16e98349ad468ae59077e88a222c18df2a42220 |
|
MD5 | a2c5986357314b2985f9faa9a1bfa54d |
|
BLAKE2b-256 | 3eb9952bfca1a6caa9018953ccb84e1975eee6767e96855c842f6ace0dd77fee |