Skip to main content

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

django-choices-enums-1.0.0.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file django-choices-enums-1.0.0.tar.gz.

File metadata

  • Download URL: django-choices-enums-1.0.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for django-choices-enums-1.0.0.tar.gz
Algorithm Hash digest
SHA256 953230fca1969b68e0065c4ff9163ec9fb8c1fbe9912287a2752d0d37319ee4c
MD5 b96c57c3de224e4d7fc3ad402fb5979c
BLAKE2b-256 0d816ee464405546d623846882918718d54cad7f3c5c136825ab87aa7dc71ed7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page