A choice field for Django using native Python Enums
Project description
A Django model field for native Python 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-3.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8e7ce6cfb978883b1052114000aa6b9c62d6497167a6ef42fc9c89dde0c6637 |
|
MD5 | e634d398566c05268738a8a704030f3f |
|
BLAKE2b-256 | 69a736f3af4aa453d5df49b177ee15f83fce6c88c6bbb6130d3a1464f457145f |
Close
Hashes for django_enumchoicefield-3.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8e2745d76834f64fd8ec45fd40ce010fabd506679207df69486cb8c40f1cfcd |
|
MD5 | c50bc59b3bcf0b31b1325574e67aa92d |
|
BLAKE2b-256 | e6aec81552ad4aa16238fc228fea69ee14e703e8fcbb21c1f523b44ac160aa64 |