switched tag field to local TagTreeModel

This commit is contained in:
Sam
2021-02-15 10:07:38 +00:00
parent 798c960ead
commit eb174f027a
4 changed files with 11 additions and 3 deletions

View File

@@ -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.

View File

@@ -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}")

View File

@@ -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'

View File

@@ -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