An IntEnumField for Django
Project description
Django IntEnumField
An IntEnumField for Django.
Features
- Store your multiple-choice options as a smallint (2 bytes) instead of varchar
- Reuse existing IntEnums as choice values
- Integrates well with Django's admin app (display and filter)
Requirements
- Python 3.6+
- Django 2.2+
Usage
from enum import IntEnum
from django.db import models
from django_intenum import IntEnumField
class Status(IntEnum):
UNKNOWN = 0
IN_PROGRESS = 1
COMPLETED = 2
ERROR = 3
class Job(models.Model):
status = IntEnumField(enum=Status)
License
This project is licensed under the MIT license. The full license text is available in the LICENSE file.
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
Built Distribution
File details
Details for the file django_intenumfield-1.5.0.tar.gz
.
File metadata
- Download URL: django_intenumfield-1.5.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4298774f52aa975cdc6cd21392c3d731018bf151f0d9b42bfdf414204e87d55d |
|
MD5 | df9876675dfb4a96faec9a566fd4004a |
|
BLAKE2b-256 | a86dff04c0aeae3e89c17e85fb0055db663afd0cfc8179f75b0184ba15c5b512 |
File details
Details for the file django_intenumfield-1.5.0-py3-none-any.whl
.
File metadata
- Download URL: django_intenumfield-1.5.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f88f068e7d15872fdf9f8f7d29ea700ab765ed67cf2cd79f3c3602e24a36ef73 |
|
MD5 | fce29c10a68b8e7466cfb354274877c0 |
|
BLAKE2b-256 | b521201771d664cd42f21dc2df36885b69a89f63350dfa75248c1b2b9e79f3e9 |