blurpritn adn site builde cleanup

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-01 02:22:02 +00:00
parent 3f2385d4d9
commit a7a772a78c
33 changed files with 1591 additions and 1308 deletions

View File

@@ -272,16 +272,13 @@ class Content(SiteSectorBaseModel):
class ContentTaxonomy(SiteSectorBaseModel):
"""
Universal taxonomy model for WordPress and IGNY8 cluster-based taxonomies.
Supports categories, tags, product attributes, and cluster mappings.
Simplified taxonomy model for AI-generated categories and tags.
Directly linked to Content via many-to-many relationship.
"""
TAXONOMY_TYPE_CHOICES = [
('category', 'Category'),
('tag', 'Tag'),
('product_category', 'Product Category'),
('product_attribute', 'Product Attribute'),
('cluster', 'Cluster Taxonomy'),
]
name = models.CharField(max_length=255, db_index=True, help_text="Term name")
@@ -290,7 +287,7 @@ class ContentTaxonomy(SiteSectorBaseModel):
max_length=50,
choices=TAXONOMY_TYPE_CHOICES,
db_index=True,
help_text="Type of taxonomy"
help_text="Type of taxonomy (category or tag)"
)
# WordPress/external platform sync fields
@@ -298,25 +295,19 @@ class ContentTaxonomy(SiteSectorBaseModel):
max_length=100,
blank=True,
default='',
help_text="WordPress taxonomy slug (category, post_tag, product_cat, pa_*) - empty for cluster taxonomies"
help_text="WordPress taxonomy slug (category, post_tag)"
)
external_id = models.IntegerField(
null=True,
blank=True,
db_index=True,
help_text="WordPress term_id - null for cluster taxonomies"
help_text="WordPress term_id for sync"
)
description = models.TextField(
blank=True,
default='',
help_text="Taxonomy term description"
)
sync_status = models.CharField(
max_length=50,
blank=True,
default='',
help_text="Synchronization status with external platforms"
)
count = models.IntegerField(
default=0,
help_text="Number of times this term is used"
@@ -324,7 +315,7 @@ class ContentTaxonomy(SiteSectorBaseModel):
metadata = models.JSONField(
default=dict,
blank=True,
help_text="Additional metadata for the taxonomy term"
help_text="Additional metadata (AI generation details, etc.)"
)
created_at = models.DateTimeField(auto_now_add=True)
@@ -483,59 +474,6 @@ class ContentClusterMap(SiteSectorBaseModel):
return f"{self.cluster.name} ({self.get_role_display()})"
class ContentTaxonomyMap(SiteSectorBaseModel):
"""Maps content entities to blueprint taxonomies for syncing/publishing."""
SOURCE_CHOICES = [
('blueprint', 'Blueprint'),
('manual', 'Manual'),
('import', 'Import'),
]
content = models.ForeignKey(
Content,
on_delete=models.CASCADE,
related_name='taxonomy_mappings',
null=True,
blank=True,
)
task = models.ForeignKey(
Tasks,
on_delete=models.CASCADE,
related_name='taxonomy_mappings',
null=True,
blank=True,
)
taxonomy = models.ForeignKey(
'site_building.SiteBlueprintTaxonomy',
on_delete=models.CASCADE,
related_name='content_mappings',
)
source = models.CharField(max_length=50, choices=SOURCE_CHOICES, default='blueprint')
metadata = models.JSONField(default=dict, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
app_label = 'writer'
db_table = 'igny8_content_taxonomy_map'
unique_together = [['content', 'taxonomy']]
indexes = [
models.Index(fields=['taxonomy']),
models.Index(fields=['content', 'taxonomy']),
models.Index(fields=['task', 'taxonomy']),
]
def save(self, *args, **kwargs):
provider = self.content or self.task
if provider:
self.account = provider.account
self.site = provider.site
self.sector = provider.sector
super().save(*args, **kwargs)
def __str__(self):
return f"{self.taxonomy.name}"
class ContentAttribute(SiteSectorBaseModel):