Feat: importando productos desde csv.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from django.db import models
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
class Sale(models.Model):
|
||||
|
||||
@@ -16,3 +16,25 @@ class SaleLine(models.Model):
|
||||
quantity = models.IntegerField(null=True)
|
||||
unit_price = models.DecimalField(max_digits=9, decimal_places=2)
|
||||
description = models.CharField(max_length=255, null=True, blank=True)
|
||||
|
||||
class MeasuringUnits(models.TextChoices):
|
||||
UNIT = 'UNIT', _('Unit')
|
||||
|
||||
class ProductCategory(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Product(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
price = models.DecimalField(max_digits=9, decimal_places=2)
|
||||
measuring_unit = models.CharField(
|
||||
max_length=20,
|
||||
choices=MeasuringUnits.choices,
|
||||
default=MeasuringUnits.UNIT
|
||||
)
|
||||
categories = models.ManyToManyField(ProductCategory)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
Reference in New Issue
Block a user