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
Release history Release notifications
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size & hash SHA256 hash help | File type | Python version | Upload date |
---|---|---|---|
django_enumchoicefield-1.0.0-py2.py3-none-any.whl (14.7 kB) Copy SHA256 hash SHA256 | Wheel | py2.py3 | Jan 31, 2018 |
django-enumchoicefield-1.0.0.tar.gz (9.5 kB) Copy SHA256 hash SHA256 | Source | None | Jan 31, 2018 |