Skip to content

mx-moth/django-enumchoicefield

Repository files navigation

Django EnumChoiceField

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

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages