popular categories

This commit is contained in:
Diego Calvo
2022-01-31 12:34:13 +01:00
parent 66016020a5
commit 6644d46f75
4 changed files with 12 additions and 6 deletions

View File

@@ -6,6 +6,11 @@ from companies.models import Company
# Create your models here.
def categoryimage_path(instance, filename):
"""Add the instance's id to the path
"""
return f"category/{instance.id}/{filename}"
class TreeTag(TagTreeModel):
class TagMeta:
initial = ""
@@ -17,6 +22,7 @@ class TreeTag(TagTreeModel):
class CategoryTag(TagTreeModel):
official = models.BooleanField('Oficial', default=False)
image = models.ImageField('Imagen de la categoría', upload_to='categories/', null=True, blank=True)
class TagMeta:
initial = ""
force_lowercase = False