Skip to main content

A choice field for Django using native Python Enums

Project description

https://travis-ci.org/timheap/django-enumchoicefield.svg?branch=master https://readthedocs.org/projects/django-enumchoicefield/badge/?version=latest https://badge.fury.io/py/django-enumchoicefield.svg

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

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-3.0.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

django_enumchoicefield-3.0.0-py2.py3-none-any.whl (18.3 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: django-enumchoicefield-3.0.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for django-enumchoicefield-3.0.0.tar.gz
Algorithm Hash digest
SHA256 e8e7ce6cfb978883b1052114000aa6b9c62d6497167a6ef42fc9c89dde0c6637
MD5 e634d398566c05268738a8a704030f3f
BLAKE2b-256 69a736f3af4aa453d5df49b177ee15f83fce6c88c6bbb6130d3a1464f457145f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_enumchoicefield-3.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for django_enumchoicefield-3.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a8e2745d76834f64fd8ec45fd40ce010fabd506679207df69486cb8c40f1cfcd
MD5 c50bc59b3bcf0b31b1325574e67aa92d
BLAKE2b-256 e6aec81552ad4aa16238fc228fea69ee14e703e8fcbb21c1f523b44ac160aa64

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