Skip to main content

An IntEnumField for Django

Project description

Django IntEnumField

Build Status

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

django_intenumfield-1.5.0.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

django_intenumfield-1.5.0-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

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