restore composer.json, add mysqli extension
This commit is contained in:
2
core/apps/vendors/models/__init__.py
vendored
2
core/apps/vendors/models/__init__.py
vendored
@@ -2,3 +2,5 @@ from .category import * # noqa
|
||||
from .vendor import * # noqa
|
||||
from .vendor_product import * # noqa
|
||||
from .section import * # noqa
|
||||
from .product_attribute import * # noqa
|
||||
from .product_variant import * # noqa
|
||||
|
||||
16
core/apps/vendors/models/product_attribute.py
vendored
Normal file
16
core/apps/vendors/models/product_attribute.py
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_core.models import AbstractBaseModel
|
||||
|
||||
|
||||
class ProductAttributeModel(AbstractBaseModel):
|
||||
firestore_id = models.CharField(verbose_name=_("firestore id"), max_length=255, unique=True, null=True, blank=True)
|
||||
name = models.CharField(verbose_name=_("name"), max_length=255)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
db_table = "product_attributes"
|
||||
verbose_name = _("Product Attribute")
|
||||
verbose_name_plural = _("Product Attributes")
|
||||
26
core/apps/vendors/models/product_variant.py
vendored
Normal file
26
core/apps/vendors/models/product_variant.py
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_core.models import AbstractBaseModel
|
||||
|
||||
|
||||
class ProductVariantModel(AbstractBaseModel):
|
||||
product = models.ForeignKey(
|
||||
"VendorproductModel",
|
||||
verbose_name=_("product"),
|
||||
on_delete=models.CASCADE,
|
||||
related_name="variants"
|
||||
)
|
||||
firestore_id = models.CharField(verbose_name=_("firestore id"), max_length=255, unique=True, null=True, blank=True)
|
||||
price = models.DecimalField(verbose_name=_("price"), max_digits=12, decimal_places=2, default=0)
|
||||
sku = models.CharField(verbose_name=_("SKU"), max_length=255, null=True, blank=True)
|
||||
quantity = models.IntegerField(verbose_name=_("quantity"), default=-1)
|
||||
image_url = models.URLField(verbose_name=_("image url"), max_length=1000, null=True, blank=True)
|
||||
attribute_data = models.JSONField(verbose_name=_("attribute data"), null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"Variant {self.sku} for {self.product.name}"
|
||||
|
||||
class Meta:
|
||||
db_table = "product_variants"
|
||||
verbose_name = _("Product Variant")
|
||||
verbose_name_plural = _("Product Variants")
|
||||
Reference in New Issue
Block a user