models delte and trash and cascade issues fixes
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user