diff --git a/companies/models.py b/companies/models.py index 1f44bf0..8b8a470 100644 --- a/companies/models.py +++ b/companies/models.py @@ -2,6 +2,8 @@ from django.contrib.gis.db import models from tagulous.models import TagField +# from core.models import TreeTag + # Create your models here. diff --git a/core/management/commands/loadgisdata.py b/core/management/commands/loadgisdata.py index efdd312..372d991 100644 --- a/core/management/commands/loadgisdata.py +++ b/core/management/commands/loadgisdata.py @@ -131,3 +131,7 @@ class Command(BaseCommand): logging.info(f"Region instances created: {region_counter}") logging.info(f"Province instances created: {province_counter}") logging.info(f"City instances created: {city_counter}") + print(f"Country instances created: {country_counter}") + print(f"Region instances created: {region_counter}") + print(f"Province instances created: {province_counter}") + print(f"City instances created: {city_counter}") diff --git a/core/models.py b/core/models.py index 2fccfe7..5e42300 100644 --- a/core/models.py +++ b/core/models.py @@ -76,6 +76,7 @@ class CustomUser(AbstractBaseUser, PermissionsMixin): class TreeTag(TagTreeModel): class TagMeta: - # initial = "food/eating, food/cooking, gaming/football" + initial = "" force_lowercase = True + max_count=20 # autocomplete_view = 'myapp.views.hobbies_autocomplete' diff --git a/products/models.py b/products/models.py index f6f7bd8..14cc0a9 100644 --- a/products/models.py +++ b/products/models.py @@ -2,6 +2,7 @@ from django.contrib.gis.db import models from tagulous.models import SingleTagField, TagField, TagTreeModel +from core.models import TreeTag from companies.models import Company # Create your models here. @@ -33,9 +34,9 @@ class Product(models.Model): 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 = TagField(force_lowercase=True, max_count=20, tree=True) + tags = TagField(to=TreeTag) category = SingleTagField(null=True) # main tag category - attributes = TagField(force_lowercase=True, max_count=20, tree=True) + attributes = TagField(to=TreeTag, related_name='product_attributes') identifiers = models.TextField('Identificador único de producto', null=True, blank=True) # internal