feat: added tags

This commit is contained in:
Pablo Moreno
2024-05-15 22:21:20 +02:00
parent 2043440499
commit 84bd7b1951
9 changed files with 219 additions and 2 deletions
+16
View File
@@ -6,6 +6,17 @@ from django.utils import timezone
from django.utils.text import gettext_lazy as _
class Tag(models.Model):
name = models.CharField(max_length=16)
def __str__(self):
return self.name
class Meta:
verbose_name = _("Etiqueta")
verbose_name_plural = _("Etiquetas")
class Product(models.Model):
name = models.CharField(
max_length=96,
@@ -30,6 +41,7 @@ class Product(models.Model):
images = models.ManyToManyField(
"files.FileUpload", blank=True, verbose_name=_("Imágenes")
)
tags = models.ManyToManyField("shop.Tag", blank=True, verbose_name=_("Etiquetas"))
def __str__(self):
return self.name
@@ -103,6 +115,10 @@ class ProductBatch(models.Model):
def __str__(self):
return f"{self.code} - {self.product.name} - {self.quantity}"
class Meta:
verbose_name = _("Remesa de producto")
verbose_name_plural = _("Remesas de productos")
class Tax(models.Model):
code = models.CharField(