added Product model
This commit is contained in:
@@ -36,3 +36,8 @@ class Company(models.Model):
|
|||||||
shipping_cost = models.DecimalField('Gastos de envío', max_digits=10, decimal_places=2, null=True, blank=True)
|
shipping_cost = models.DecimalField('Gastos de envío', max_digits=10, decimal_places=2, null=True, blank=True)
|
||||||
# tags
|
# tags
|
||||||
sync = models.BooleanField('Sincronizar tienda', default=False, null=True, blank=True)
|
sync = models.BooleanField('Sincronizar tienda', default=False, null=True, blank=True)
|
||||||
|
|
||||||
|
# internal
|
||||||
|
created = models.DateTimeField('date of creation', auto_now_add=True)
|
||||||
|
updated = models.DateTimeField('date last update', auto_now=True)
|
||||||
|
creator = models.ForeignKey('core.CustomUser', on_delete=models.DO_NOTHING, null=True, related_name='company')
|
||||||
@@ -1,3 +1,42 @@
|
|||||||
from django.db import models
|
from django.contrib.gis.db import models
|
||||||
|
|
||||||
|
from companies.models import Company
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
|
class Product(models.Model):
|
||||||
|
|
||||||
|
SYNCHRONIZED = 'SYNCHRONIZED'
|
||||||
|
IMPORTED = 'IMPORTED'
|
||||||
|
MANUAL = 'MANUAL'
|
||||||
|
|
||||||
|
SOURCES = (
|
||||||
|
(SYNCHRONIZED, 'Sincronizado'),
|
||||||
|
(IMPORTED, 'Importado'),
|
||||||
|
(MANUAL, 'Manual'),
|
||||||
|
)
|
||||||
|
|
||||||
|
company = models.ForeignKey(Company, on_delete=models.DO_NOTHING, null=True, blank=True)
|
||||||
|
sku = models.CharField('Referencia de producto', max_length=255, null=True, blank=True )
|
||||||
|
name = models.CharField('Nombre del producto', max_length=500, null=True, blank=True)
|
||||||
|
description = models.TextField('Descripción', null=True, blank=True)
|
||||||
|
image = models.ImageField('Imagen del producto', upload_to='products/', null=True, blank=True)
|
||||||
|
url = models.URLField('URL del producto', null=True, blank=True)
|
||||||
|
price = models.DecimalField('Precio', max_digits=10, decimal_places=2, null=True, blank=True)
|
||||||
|
shipping_cost = models.DecimalField('Gastos de envío', max_digits=10, decimal_places=2, null=True, blank=True)
|
||||||
|
shipping_terms = models.TextField('Condiciones de envío', null=True, blank=True)
|
||||||
|
source = models.CharField('Fuente', choices=SOURCES, max_length=25, null=True, blank=True)
|
||||||
|
sourcing_date = models.DateTimeField('Fecha de importación original de producto', null=True, blank=True)
|
||||||
|
update_date = models.DateTimeField('Fecha de actualización de producto', null=True, blank=True)
|
||||||
|
discount = models.DecimalField('Descuento', max_digits=5, decimal_places=2, null=True, blank=True)
|
||||||
|
stock = models.PositiveIntegerField('Stock', null=True)
|
||||||
|
# tags
|
||||||
|
# category (main tag)
|
||||||
|
# identifiers = models.ManyToManyField('ean', null=True, blank=True) # EAN, UPC, MPN ???
|
||||||
|
|
||||||
|
# internal
|
||||||
|
created = models.DateTimeField('date of creation', auto_now_add=True)
|
||||||
|
updated = models.DateTimeField('date last update', auto_now=True)
|
||||||
|
creator = models.ForeignKey('core.CustomUser', on_delete=models.DO_NOTHING, null=True, related_name='product')
|
||||||
|
# history = models.FoiregnKey('history.History', on_delete=models.DO_NOTHING, null=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user