Skip to content

Commit

Permalink
Remove usage of django-choices
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Feb 14, 2024
1 parent 1d63a27 commit 4fe2ab9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 25 deletions.
1 change: 0 additions & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jsonschema
django
django-admin-index
django-axes
django-choices
django-hijack
django-jsonsuit
django-redis
Expand Down
4 changes: 1 addition & 3 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ django-admin-index==3.0.0
django-axes==5.41.1
# via -r requirements/base.in
django-choices==1.7.2
# via
# -r requirements/base.in
# commonground-api-common
# via commonground-api-common
django-filter==23.2
# via
# -r requirements/base.in
Expand Down
39 changes: 18 additions & 21 deletions src/objecttypes/core/constants.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
from django.db import models
from django.utils.translation import gettext_lazy as _

from djchoices import ChoiceItem, DjangoChoices

class ObjectVersionStatus(models.TextChoices):
published = "published", _("Published")
draft = "draft", _("Draft")
deprecated = "deprecated", _("Deprecated")

class ObjectVersionStatus(DjangoChoices):
published = ChoiceItem("published", _("Published"))
draft = ChoiceItem("draft", _("Draft"))
deprecated = ChoiceItem("deprecated", _("Deprecated"))

class DataClassificationChoices(models.TextChoices):
open = "open", _("Open")
intern = "intern", _("Intern")
confidential = "confidential", _("Confidential")
strictly_confidential = "strictly_confidential", _("Strictly confidential")

class DataClassificationChoices(DjangoChoices):
open = ChoiceItem("open", _("Open"))
intern = ChoiceItem("intern", _("Intern"))
confidential = ChoiceItem("confidential", _("Confidential"))
strictly_confidential = ChoiceItem(
"strictly_confidential", _("Strictly confidential")
)


class UpdateFrequencyChoices(DjangoChoices):
real_time = ChoiceItem("real_time", _("Real-time"))
hourly = ChoiceItem("hourly", _("Hourly"))
daily = ChoiceItem("daily", _("Daily"))
weekly = ChoiceItem("weekly", _("Weekly"))
monthly = ChoiceItem("monthly", _("Monthly"))
yearly = ChoiceItem("yearly", _("Yearly"))
unknown = ChoiceItem("unknown", _("Unknown"))
class UpdateFrequencyChoices(models.TextChoices):
real_time = "real_time", _("Real-time")
hourly = "hourly", _("Hourly")
daily = "daily", _("Daily")
weekly = "weekly", _("Weekly")
monthly = "monthly", _("Monthly")
yearly = "yearly", _("Yearly")
unknown = "unknown", _("Unknown")

0 comments on commit 4fe2ab9

Please sign in to comment.