27 lines
897 B
Python
27 lines
897 B
Python
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"]
|