be fe fixes

This commit is contained in:
IGNY8 VPS (Salman)
2025-11-26 10:43:51 +00:00
parent 4fe68cc271
commit 1cbc347cdc
15 changed files with 5557 additions and 149 deletions

View File

@@ -102,10 +102,6 @@ class ContentAdmin(SiteSectorAdminMixin, admin.ModelAdmin):
('Content', {
'fields': ('content_html',)
}),
('Taxonomy', {
'fields': ('taxonomy_terms',),
'description': 'Categories, tags, and other taxonomy terms'
}),
('WordPress Sync', {
'fields': ('external_id', 'external_url'),
'classes': ('collapse',)

View File

@@ -488,14 +488,12 @@ class ImagesViewSet(SiteSectorModelViewSet):
# Update by content_id if provided, otherwise by image IDs
if content_id:
try:
# Get the content object to also update images linked via task
# Get the content object to also update images linked directly to content
content = Content.objects.get(id=content_id)
# Update images linked directly to content OR via task (same logic as content_images endpoint)
# This ensures we update all images: featured + 1-6 in-article images
updated_count = queryset.filter(
Q(content=content) | Q(task=content.task)
).update(status=status_value)
# Update images linked directly to content (all images: featured + in-article)
# Note: task field was removed in refactor - images now link directly to content
updated_count = queryset.filter(content=content).update(status=status_value)
except Content.DoesNotExist:
return error_response(
error='Content not found',
@@ -670,8 +668,8 @@ class ImagesViewSet(SiteSectorModelViewSet):
'validation_errors': errors,
'publish_errors': publish_errors,
'metadata': {
'has_entity_type': bool(content.entity_type),
'entity_type': content.entity_type,
'has_entity_type': bool(content.content_type),
'entity_type': content.content_type,
'has_cluster_mapping': self._has_cluster_mapping(content),
'has_taxonomy_mapping': self._has_taxonomy_mapping(content),
}
@@ -691,9 +689,9 @@ class ImagesViewSet(SiteSectorModelViewSet):
validation_service = ContentValidationService()
# Persist metadata mappings if task exists
if content.task:
mapping_service = MetadataMappingService()
mapping_service.persist_task_metadata_to_content(content)
# Metadata is now persisted directly on content - no task linkage needed
# mapping_service = MetadataMappingService() # DEPRECATED
# mapping_service.persist_task_metadata_to_content(content) # DEPRECATED
errors = validation_service.validate_for_publish(content)
@@ -970,8 +968,8 @@ class ContentViewSet(SiteSectorModelViewSet):
'validation_errors': errors,
'publish_errors': publish_errors,
'metadata': {
'has_entity_type': bool(content.entity_type),
'entity_type': content.entity_type,
'has_entity_type': bool(content.content_type),
'entity_type': content.content_type,
'has_cluster_mapping': self._has_cluster_mapping(content),
'has_taxonomy_mapping': self._has_taxonomy_mapping(content),
}
@@ -991,9 +989,9 @@ class ContentViewSet(SiteSectorModelViewSet):
validation_service = ContentValidationService()
# Persist metadata mappings if task exists
if content.task:
mapping_service = MetadataMappingService()
mapping_service.persist_task_metadata_to_content(content)
# Metadata is now persisted directly on content - no task linkage needed
# mapping_service = MetadataMappingService() # DEPRECATED
# mapping_service.persist_task_metadata_to_content(content) # DEPRECATED
errors = validation_service.validate_for_publish(content)
@@ -1121,8 +1119,8 @@ class ContentViewSet(SiteSectorModelViewSet):
'validation_errors': errors,
'publish_errors': publish_errors,
'metadata': {
'has_entity_type': bool(content.entity_type),
'entity_type': content.entity_type,
'has_entity_type': bool(content.content_type),
'entity_type': content.content_type,
'has_cluster_mapping': self._has_cluster_mapping(content),
'has_taxonomy_mapping': self._has_taxonomy_mapping(content),
}
@@ -1142,9 +1140,9 @@ class ContentViewSet(SiteSectorModelViewSet):
validation_service = ContentValidationService()
# Persist metadata mappings if task exists
if content.task:
mapping_service = MetadataMappingService()
mapping_service.persist_task_metadata_to_content(content)
# Metadata is now persisted directly on content - no task linkage needed
# mapping_service = MetadataMappingService() # DEPRECATED
# mapping_service.persist_task_metadata_to_content(content) # DEPRECATED
errors = validation_service.validate_for_publish(content)
@@ -1272,8 +1270,8 @@ class ContentViewSet(SiteSectorModelViewSet):
'validation_errors': errors,
'publish_errors': publish_errors,
'metadata': {
'has_entity_type': bool(content.entity_type),
'entity_type': content.entity_type,
'has_entity_type': bool(content.content_type),
'entity_type': content.content_type,
'has_cluster_mapping': self._has_cluster_mapping(content),
'has_taxonomy_mapping': self._has_taxonomy_mapping(content),
}
@@ -1293,9 +1291,9 @@ class ContentViewSet(SiteSectorModelViewSet):
validation_service = ContentValidationService()
# Persist metadata mappings if task exists
if content.task:
mapping_service = MetadataMappingService()
mapping_service.persist_task_metadata_to_content(content)
# Metadata is now persisted directly on content - no task linkage needed
# mapping_service = MetadataMappingService() # DEPRECATED
# mapping_service.persist_task_metadata_to_content(content) # DEPRECATED
errors = validation_service.validate_for_publish(content)
@@ -1422,8 +1420,8 @@ class ContentViewSet(SiteSectorModelViewSet):
'validation_errors': errors,
'publish_errors': publish_errors,
'metadata': {
'has_entity_type': bool(content.entity_type),
'entity_type': content.entity_type,
'has_entity_type': bool(content.content_type),
'entity_type': content.content_type,
'has_cluster_mapping': self._has_cluster_mapping(content),
'has_taxonomy_mapping': self._has_taxonomy_mapping(content),
}
@@ -1443,9 +1441,9 @@ class ContentViewSet(SiteSectorModelViewSet):
validation_service = ContentValidationService()
# Persist metadata mappings if task exists
if content.task:
mapping_service = MetadataMappingService()
mapping_service.persist_task_metadata_to_content(content)
# Metadata is now persisted directly on content - no task linkage needed
# mapping_service = MetadataMappingService() # DEPRECATED
# mapping_service.persist_task_metadata_to_content(content) # DEPRECATED
errors = validation_service.validate_for_publish(content)
@@ -1466,7 +1464,7 @@ class ContentViewSet(SiteSectorModelViewSet):
def _has_taxonomy_mapping(self, content):
"""Helper to check if content has taxonomy mapping"""
# Check new M2M relationship
return content.taxonomies.exists()
return content.taxonomy_terms.exists()
@extend_schema_view(

File diff suppressed because it is too large Load Diff