update
This commit is contained in:
4
core/apps/api/models/common/__init__.py
Normal file
4
core/apps/api/models/common/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .tags import *
|
||||
from .plan import *
|
||||
from .size import * # noqa
|
||||
from .color import * # noqa
|
||||
17
core/apps/api/models/common/color.py
Normal file
17
core/apps/api/models/common/color.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.db import models
|
||||
from django_core.models.base import AbstractBaseModel
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class ColorModel(AbstractBaseModel):
|
||||
name = models.CharField(_("Name"), max_length=255, unique=True)
|
||||
color = models.CharField(_("Color"), max_length=255, null=True, blank=False)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
db_table = "color"
|
||||
verbose_name = _("Color")
|
||||
verbose_name_plural = _("Colors")
|
||||
ordering = ["name"]
|
||||
26
core/apps/api/models/common/plan.py
Normal file
26
core/apps/api/models/common/plan.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from django.db import models
|
||||
from django_core.models.base import AbstractBaseModel
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.core.validators import MinValueValidator
|
||||
|
||||
|
||||
class AdTopPlanModel(AbstractBaseModel):
|
||||
name = models.CharField(_("Plan Name"), max_length=255, unique=True)
|
||||
price = models.DecimalField(
|
||||
_("Price"),
|
||||
max_digits=10,
|
||||
decimal_places=2,
|
||||
validators=[MinValueValidator(0)]
|
||||
)
|
||||
duration = models.PositiveIntegerField(_("Duration (days)"))
|
||||
description = models.TextField(_("Description"), blank=True)
|
||||
is_active = models.BooleanField(_("Is Active"), default=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.name} - {self.duration} days"
|
||||
|
||||
class Meta:
|
||||
db_table = "ad_top_plan"
|
||||
verbose_name = _("Ad Top Plan")
|
||||
verbose_name_plural = _("Ad Top Plans")
|
||||
ordering = ["price"]
|
||||
16
core/apps/api/models/common/size.py
Normal file
16
core/apps/api/models/common/size.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from django.db import models
|
||||
from django_core.models.base import AbstractBaseModel
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class SizeModel(AbstractBaseModel):
|
||||
name = models.CharField(_("Name"), max_length=100, unique=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
db_table = "size"
|
||||
verbose_name = _("Size")
|
||||
verbose_name_plural = _("Sizes")
|
||||
ordering = ["name"]
|
||||
17
core/apps/api/models/common/tags.py
Normal file
17
core/apps/api/models/common/tags.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.db import models
|
||||
from django_core.models.base import AbstractBaseModel
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class TagsModel(AbstractBaseModel):
|
||||
name = models.CharField(_("Tag Name"), max_length=255, unique=True)
|
||||
slug = models.SlugField(_("Slug"), max_length=255, unique=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
db_table = "tags"
|
||||
verbose_name = _("Tag")
|
||||
verbose_name_plural = _("Tags")
|
||||
ordering = ["name"]
|
||||
Reference in New Issue
Block a user