Commit cd8a6a4a authored by Morten Nordseth's avatar Morten Nordseth
Browse files

smell - enumeration types

parent d17fcb94
Pipeline #128554 canceled with stages
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.contrib.auth import get_user_model
from django.utils.translation import gettext_lazy as _
......@@ -62,14 +62,10 @@ class Offer(models.Model):
get_user_model(), on_delete=models.CASCADE, related_name="received_offers"
)
ACCEPTED = "a"
PENDING = "p"
DECLINED = "d"
STATUS_CHOICES = (
(ACCEPTED, "Accepted"),
(PENDING, "Pending"),
(DECLINED, "Declined"),
)
class StatusChoices(models.TextChoices):
ACCEPTED = "a", _("Accepted")
PENDING = "p", _("Pending")
DECLINED = "d", _("Declined")
status = models.CharField(max_length=8, choices=STATUS_CHOICES, default=PENDING)
status = models.CharField(max_length=8, choices=StatusChoices.choices, default=StatusChoices.PENDING)
timestamp = models.DateTimeField(auto_now_add=True)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment