model_utils.py 238 B

123456789
  1. from django.db import models
  2. class FromStringIntegerChoices(models.IntegerChoices):
  3. @classmethod
  4. def from_string(cls, string: str):
  5. for status in cls:
  6. if status.label == string:
  7. return status