57 lines
2.7 KiB
Python
57 lines
2.7 KiB
Python
# from django.db import models
|
|
from django.contrib.gis.db import models
|
|
|
|
from tagulous.models import TagField
|
|
# from core.models import TreeTag
|
|
|
|
|
|
# Create your models here.
|
|
|
|
class Company(models.Model):
|
|
|
|
WOO_COMMERCE = 'WOO_COMMERCE'
|
|
SHOPIFY = 'SHOPIFY'
|
|
PRESTASHOP = 'PRESTASHOP'
|
|
|
|
PLATFORMS = (
|
|
(WOO_COMMERCE, 'WooCommerce'),
|
|
(SHOPIFY, 'Shopify'),
|
|
(PRESTASHOP, 'Prestashop'),
|
|
)
|
|
|
|
cif = models.CharField('CIF', max_length=15, null=True, blank=True)
|
|
company_name = models.CharField('Razón Social Cooperativa', max_length=1000, null=True, blank=True)
|
|
short_name = models.CharField('Apócope', max_length=100, null=True, blank=True) # autogenerar si blank
|
|
web_link = models.URLField('Enlace a la web', null=True, blank=True)
|
|
shop = models.BooleanField('Tienda Online', null=True, default=False)
|
|
shop_link = models.URLField('Enlace a la tienda', null=True, blank=True)
|
|
platform = models.CharField('Plataforma de tienda online', choices=PLATFORMS, max_length=25, null=True, blank=True)
|
|
email = models.EmailField('Email', null=True, blank=True)
|
|
logo = models.ImageField('Logo', upload_to='logos/', null=True, blank=True)
|
|
city = models.CharField('Municipio', max_length=1000, null=True, blank=True)
|
|
address = models.CharField('Dirección', max_length=1000, null=True, blank=True)
|
|
geo = models.PointField('Coordenadas', null=True, blank=True )
|
|
phone = models.CharField('Teléfono', max_length=25, null=True, blank=True)
|
|
mobile = models.CharField('Teléfono móvil', max_length=25, null=True, blank=True)
|
|
other_phone = models.CharField('Otro teléfono', max_length=25, null=True, blank=True)
|
|
description = models.TextField('Descripción de la cooperativa', null=True, blank=True)
|
|
shop_rss_feed = models.URLField('RSS tienda online', null=True, blank=True)
|
|
sale_terms = models.TextField('Condiciones de venta', null=True, blank=True)
|
|
shipping_cost = models.DecimalField('Gastos de envío', max_digits=10, decimal_places=2, null=True, blank=True)
|
|
tags = TagField(force_lowercase=True,max_count=5, tree=True)
|
|
sync = models.BooleanField('Sincronizar tienda', default=False, null=True, blank=True)
|
|
is_validated = models.BooleanField('Validado', default=False, null=True, blank=True)
|
|
is_active = models.BooleanField('Activado', 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='creator')
|
|
|
|
def __str__(self):
|
|
return self.company_name
|
|
|
|
class Meta:
|
|
verbose_name = "Compañía"
|
|
verbose_name_plural = "Compañías"
|