text: from django.db import models
  from django.utils.translation import gettext_lazy as _
  from django.core.validators import MinValueValidator, MaxValueValidator
  from django.utils.text import slugify
  from django.core.exceptions import ValidationError
  from datetime import datetime
  
  
  class User(models.Model):
      id = models.AutoField(primary_key=True)
      username = models.CharField(max_length=50)
  
      def __str__(self):
          return f"{self.username}"
  
  
  class Task(models.Model):
      class PriorityClasses(models.TextChoices):
          LOW = "LW", _("Low")
          MEDIUM = "MD", _("Medium")
          HIGH = "HG", _("High")
          CRITICAL = "CT", _("Critical")
  
      class TaskStatus(models.TextChoices):
          NOT_STARTED = "NS", _("Not Started")
          IN_PROGRESS = "IP", _("In Progress")
          DONE = "DN", _("Done")
          OBSOLETE = "OB", _("Obsolete")
  
      id = models.AutoField(primary_key=True)
      task_name = models.CharField(max_length=50)
      slug = models.SlugField(db_index=True, editable=False)
      user_id = models.ForeignKey(User, on_delete=models.CASCADE)
      description = models.TextField(max_length=1000)
      priority = models.CharField(max_length=2, choices=PriorityClasses.choices,
                                  default=PriorityClasses.MEDIUM)
      status = models.CharField(max_length=2, choices=TaskStatus.choices,
                                default=TaskStatus.NOT_STARTED)
      logged_time = models.FloatField(validators=[MinValueValidator(0)], default=0)
      story_points = models.IntegerField(validators=[MinValueValidator(1),
                                         MaxValueValidator(16)], default=1)
      created_at = models.DateTimeField(auto_now_add=True)
      updated_at = models.DateTimeField(auto_now=True)
  
      def __str__(self):
          return f"{self.id} {self.slug} {self.task_name}"
  
      def save(self, *args, **kwargs):
          self.slug = slugify(self.task_name)
          self.slug += slugify(datetime.now())
          super().save(*args, **kwargs)
  