This commit is contained in:
IGNY8 VPS (Salman)
2025-11-29 08:59:31 +00:00
parent 4bea79a76d
commit 4237c203b4
18 changed files with 507 additions and 52 deletions

View File

@@ -154,6 +154,8 @@ class ContentSerializer(serializers.ModelSerializer):
cluster_name = serializers.SerializerMethodField()
sector_name = serializers.SerializerMethodField()
taxonomy_terms_data = serializers.SerializerMethodField()
tags = serializers.SerializerMethodField()
categories = serializers.SerializerMethodField()
has_image_prompts = serializers.SerializerMethodField()
image_status = serializers.SerializerMethodField()
has_generated_images = serializers.SerializerMethodField()
@@ -175,6 +177,8 @@ class ContentSerializer(serializers.ModelSerializer):
'content_type',
'content_structure',
'taxonomy_terms_data',
'tags',
'categories',
'external_id',
'external_url',
'source',
@@ -246,6 +250,20 @@ class ContentSerializer(serializers.ModelSerializer):
for term in obj.taxonomy_terms.all()
]
def get_tags(self, obj):
"""Get only tags (taxonomy_type='tag')"""
return [
term.name
for term in obj.taxonomy_terms.filter(taxonomy_type='tag')
]
def get_categories(self, obj):
"""Get only categories (taxonomy_type='category')"""
return [
term.name
for term in obj.taxonomy_terms.filter(taxonomy_type='category')
]
def get_has_image_prompts(self, obj):
"""Check if content has any image prompts (images with prompts)"""
return obj.images.filter(prompt__isnull=False).exclude(prompt='').exists()