Skip to content

Latest commit

 

History

53 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.8+
  • 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.

About

An IntEnumField for Django

Topics

Resources

Stars

2 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages