From b5887c5c51771126ecd65b0fd72c2c4a57ac97d1 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 2 Feb 2021 12:21:42 +0000 Subject: [PATCH] reenabled django suit --- back_latienda/settings/base.py | 3 +++ companies/factories.py | 6 +++--- companies/models.py | 11 ++++++++++- core/admin.py | 3 +++ products/models.py | 6 ++++++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/back_latienda/settings/base.py b/back_latienda/settings/base.py index a407d89..3eaa173 100644 --- a/back_latienda/settings/base.py +++ b/back_latienda/settings/base.py @@ -33,12 +33,15 @@ SECRET_KEY = 'td*#7t-(1e9^(g0cod*hs**dp(%zvg@=$cug_-dtzcj#i2mrz@' # Application definition INSTALLED_APPS = [ + 'suit', + 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'django.contrib.gis', # 3rd party 'rest_framework', diff --git a/companies/factories.py b/companies/factories.py index 2c61558..01880cc 100644 --- a/companies/factories.py +++ b/companies/factories.py @@ -11,9 +11,9 @@ class CompanyFactory(DjangoModelFactory): cif = FuzzyText(prefix='CIF_', length=10) company_name = FuzzyText(prefix='COMPANY_NAME_', length=10) short_name = FuzzyText(prefix='SHORT_NAME_', length=10) - web_link = FuzzyText(prefix='http://WEB_LINK_', suffix='.test', length=10) + web_link = FuzzyText(prefix='http://WEB-LINK-', suffix='.test', length=10) shop = FuzzyChoice(choices=(True, False)) - shop_link = FuzzyText(prefix='http://SHOP_LINK_', suffix='.test', length=10) + shop_link = FuzzyText(prefix='http://SHOP-LINK-', suffix='.test', length=10) platform = FuzzyChoice(choices=[x[1] for x in Company.PLATFORMS]) email = FuzzyText(prefix='EMAIL_', suffix='@test.com', length=10) logo = None @@ -24,7 +24,7 @@ class CompanyFactory(DjangoModelFactory): mobile = '+34666555333' other_phone = '+34666555222' description = FuzzyText(prefix='DESCRIPTION_', length=250) - shop_rss_feed = FuzzyText(prefix='http://SHOP_RSS_FEED_', suffix='.test', length=10) + shop_rss_feed = FuzzyText(prefix='http://SHOP-RSS-FEED-', suffix='.test', length=10) sale_terms = FuzzyText(prefix='SALES_TERMS', length=250) shipping_cost = FuzzyDecimal(low=1.00) tags = ['cool', 'hip', 'tech/blockchain'] diff --git a/companies/models.py b/companies/models.py index a830e03..3fb2ab7 100644 --- a/companies/models.py +++ b/companies/models.py @@ -38,8 +38,17 @@ class Company(models.Model): 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') \ No newline at end of file + 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" diff --git a/core/admin.py b/core/admin.py index 8c38f3f..e6daebe 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,6 @@ from django.contrib import admin +from . import models # Register your models here. + +admin.site.register(models.CustomUser) diff --git a/products/models.py b/products/models.py index 3dc9742..7ef0b98 100644 --- a/products/models.py +++ b/products/models.py @@ -43,3 +43,9 @@ class Product(models.Model): 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) + def __str__(self): + return f"{self.name} / {self.sku}" + + class Meta: + verbose_name = "Producto" + verbose_name_plural = "Productos"