The enum type used for Django choices enables Django's choices to support code prompts!!
Project description
django-choices-enums
The enum type used for Django choices enables Django’s choices to support code prompts!!
用于django choices的枚举类型,使得django的choices支持代码提示!!
依赖
python3+
Installation
pip install django-choices-enums
Usage
from django_choices_enums import DjangoChoicesEnum
class TypeChoices(DjangoChoicesEnum):
Created = (1,'created')
Finished = (2,'finished')
class Foo(models.Model):
type = models.IntegerField(choices=TypeChoices.to_django_choices())
use enum like this:
f = Foo.create(type=TypeChoices.Created)
get all values:
print(TypeChoices.all_values())
# Out: [1, 2]
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
Close
Hashes for django-choices-enums-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 953230fca1969b68e0065c4ff9163ec9fb8c1fbe9912287a2752d0d37319ee4c |
|
MD5 | b96c57c3de224e4d7fc3ad402fb5979c |
|
BLAKE2b-256 | 0d816ee464405546d623846882918718d54cad7f3c5c136825ab87aa7dc71ed7 |