models delte and trash and cascade issues fixes

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-12 17:37:21 +00:00
parent 4ba3870878
commit ad828a9fcd
5 changed files with 198 additions and 12 deletions

View File

@@ -440,10 +440,11 @@ class Content(SoftDeletableModel, SiteSectorBaseModel):
return super().hard_delete(using=using, keep_parents=keep_parents)
class ContentTaxonomy(SiteSectorBaseModel):
class ContentTaxonomy(SoftDeletableModel, SiteSectorBaseModel):
"""
Simplified taxonomy model for AI-generated categories and tags.
Directly linked to Content via many-to-many relationship.
Supports soft-delete for trash/restore functionality.
"""
TAXONOMY_TYPE_CHOICES = [
@@ -497,6 +498,9 @@ class ContentTaxonomy(SiteSectorBaseModel):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
objects = SoftDeleteManager()
all_objects = models.Manager()
class Meta:
app_label = 'writer'
db_table = 'igny8_content_taxonomy_terms'

View File

@@ -79,7 +79,7 @@ class Keywords(SoftDeletableModel, SiteSectorBaseModel):
# Required: Link to global SeedKeyword
seed_keyword = models.ForeignKey(
SeedKeyword,
on_delete=models.PROTECT, # Prevent deletion if Keywords reference it
on_delete=models.CASCADE, # Allow deletion of SeedKeyword (cascades to Keywords)
related_name='site_keywords',
help_text="Reference to the global seed keyword"
)