Modellar tayyor
This commit is contained in:
6
core/apps/api/models/ad_items/__init__.py
Normal file
6
core/apps/api/models/ad_items/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from .ad_top_plan import * # noqa
|
||||
from .tags import * # noqa
|
||||
from .ad_images import * # noqa
|
||||
from .ad_option import * # noqa
|
||||
from .ad_size import * # noqa
|
||||
from .ad_variant import * # noqa
|
||||
17
core/apps/api/models/ad_items/ad_images.py
Normal file
17
core/apps/api/models/ad_items/ad_images.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 _
|
||||
from core.apps.api.models.ad.ad import AdModel
|
||||
|
||||
|
||||
class AdImage(AbstractBaseModel):
|
||||
image = models.ImageField(verbose_name=_("Image"), upload_to="ads/images/")
|
||||
ad = models.ForeignKey(AdModel, verbose_name=_("Ad"), on_delete=models.CASCADE)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.pk)
|
||||
|
||||
class Meta:
|
||||
db_table = "ad_images"
|
||||
verbose_name = _("Ad_Image")
|
||||
verbose_name_plural = _("Ad_Images")
|
||||
18
core/apps/api/models/ad_items/ad_option.py
Normal file
18
core/apps/api/models/ad_items/ad_option.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from django.db import models
|
||||
from django_core.models.base import AbstractBaseModel
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from core.apps.api.models import AdModel
|
||||
|
||||
|
||||
class AdOption(AbstractBaseModel):
|
||||
name = models.CharField(_("Name"), max_length=255)
|
||||
value = models.CharField(_("Value"), max_length=255)
|
||||
ad = models.ForeignKey(AdModel, on_delete=models.CASCADE)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.pk)
|
||||
|
||||
class Meta:
|
||||
db_table = "ad_option"
|
||||
verbose_name = _("Ad_Option")
|
||||
verbose_name_plural = _("Ad_Options")
|
||||
20
core/apps/api/models/ad_items/ad_size.py
Normal file
20
core/apps/api/models/ad_items/ad_size.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from django.db import models
|
||||
from django_core.models.base import AbstractBaseModel
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from core.apps.api.models import AdModel
|
||||
|
||||
|
||||
class AdSize(AbstractBaseModel):
|
||||
ad = models.ForeignKey(AdModel, on_delete=models.CASCADE)
|
||||
weight = models.PositiveIntegerField(verbose_name=_("Weight"))
|
||||
width = models.PositiveIntegerField(verbose_name=_("Width"))
|
||||
height = models.PositiveIntegerField(verbose_name=_("Height"))
|
||||
length = models.PositiveIntegerField(verbose_name=_("Length"))
|
||||
|
||||
def __str__(self):
|
||||
return str(self.pk)
|
||||
|
||||
class Meta:
|
||||
db_table = "ad_size"
|
||||
verbose_name = _("AdSize")
|
||||
verbose_name_plural = _("AdSizes")
|
||||
16
core/apps/api/models/ad_items/ad_top_plan.py
Normal file
16
core/apps/api/models/ad_items/ad_top_plan.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 AdTopPlan(AbstractBaseModel):
|
||||
name = models.CharField(verbose_name=_('Name'), max_length=255)
|
||||
price = models.DecimalField(verbose_name=_('Price'), max_digits=10, decimal_places=2)
|
||||
duration = models.IntegerField(verbose_name=_('Duration'))
|
||||
|
||||
def __str__(self):
|
||||
return str(self.pk)
|
||||
class Meta:
|
||||
db_table = 'ad_top_plan'
|
||||
verbose_name = _('AdTop Plan')
|
||||
verbose_name_plural = _('AdTop Plan')
|
||||
22
core/apps/api/models/ad_items/ad_variant.py
Normal file
22
core/apps/api/models/ad_items/ad_variant.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from django.db import models
|
||||
from django_core.models.base import AbstractBaseModel
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from core.apps.api.models import AdModel
|
||||
from core.apps.api.choices.ad_variant_type import AdVariantType
|
||||
|
||||
|
||||
class AdVariant(AbstractBaseModel):
|
||||
ad = models.ForeignKey(AdModel, on_delete=models.CASCADE)
|
||||
variant = models.CharField(max_length=255, choices=AdVariantType, db_index=True)
|
||||
value = models.CharField(max_length=255)
|
||||
is_available = models.CharField(max_length=255)
|
||||
price = models.DecimalField(max_digits=10, decimal_places=2)
|
||||
discount = models.DecimalField(max_digits=10, decimal_places=2, default=-1)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.pk)
|
||||
|
||||
class Meta:
|
||||
db_table = "ad_variant"
|
||||
verbose_name = _("Ad_Variant")
|
||||
verbose_name_plural = _("Ad_Variants")
|
||||
15
core/apps/api/models/ad_items/tags.py
Normal file
15
core/apps/api/models/ad_items/tags.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from django.db import models
|
||||
from django_core.models.base import AbstractBaseModel
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class Tags(AbstractBaseModel):
|
||||
name = models.CharField(verbose_name=_("Name"), max_length=255)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.pk)
|
||||
|
||||
class Meta:
|
||||
db_table = 'tags'
|
||||
verbose_name = _("Tags")
|
||||
verbose_name_plural = _("Tags")
|
||||
Reference in New Issue
Block a user