Remove unused files and enhance error handling in serializers.py

- Deleted the outdated backend dependency file for drf-spectacular.
- Removed an unused image from the frontend assets.
- Improved error handling in TasksSerializer by catching ObjectDoesNotExist in addition to AttributeError.
This commit is contained in:
IGNY8 VPS (Salman)
2025-11-17 13:21:32 +00:00
parent 2605c62eec
commit e3d4ba2c02
4 changed files with 121 additions and 38 deletions

View File

@@ -0,0 +1,119 @@
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('igny8_core_auth', '0008_passwordresettoken_alter_industry_options_and_more'),
('writer', '0008_change_image_url_to_charfield'),
]
operations = [
migrations.AddField(
model_name='content',
name='source',
field=models.CharField(
choices=[
('igny8', 'IGNY8 Generated'),
('wordpress', 'WordPress Synced'),
('shopify', 'Shopify Synced'),
('custom', 'Custom API Synced'),
],
db_index=True,
default='igny8',
help_text='Source of the content',
max_length=50,
),
),
migrations.AddField(
model_name='content',
name='sync_status',
field=models.CharField(
choices=[
('native', 'Native IGNY8 Content'),
('imported', 'Imported from External'),
('synced', 'Synced from External'),
],
db_index=True,
default='native',
help_text='Sync status of the content',
max_length=50,
),
),
migrations.AddField(
model_name='content',
name='external_id',
field=models.CharField(
blank=True,
help_text='External platform ID',
max_length=255,
null=True,
),
),
migrations.AddField(
model_name='content',
name='external_url',
field=models.URLField(
blank=True,
help_text='External platform URL',
null=True,
),
),
migrations.AddField(
model_name='content',
name='sync_metadata',
field=models.JSONField(
blank=True,
default=dict,
help_text='Platform-specific sync metadata',
),
),
migrations.AddField(
model_name='content',
name='internal_links',
field=models.JSONField(
blank=True,
default=list,
help_text='Internal links added by linker',
),
),
migrations.AddField(
model_name='content',
name='linker_version',
field=models.IntegerField(
default=0,
help_text='Version of linker processing',
),
),
migrations.AddField(
model_name='content',
name='optimizer_version',
field=models.IntegerField(
default=0,
help_text='Version of optimizer processing',
),
),
migrations.AddField(
model_name='content',
name='optimization_scores',
field=models.JSONField(
blank=True,
default=dict,
help_text='Optimization scores (SEO, readability, engagement)',
),
),
migrations.AddIndex(
model_name='content',
index=models.Index(fields=['source'], name='igny8_conte_source_idx'),
),
migrations.AddIndex(
model_name='content',
index=models.Index(fields=['sync_status'], name='igny8_conte_sync_idx'),
),
migrations.AddIndex(
model_name='content',
index=models.Index(fields=['source', 'sync_status'], name='igny8_conte_source_sync_idx'),
),
]

View File

@@ -1,5 +1,6 @@
from rest_framework import serializers
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
from .models import Tasks, Images, Content
from igny8_core.business.planning.models import Clusters, ContentIdeas
@@ -85,7 +86,7 @@ class TasksSerializer(serializers.ModelSerializer):
def _get_content_record(self, obj):
try:
return obj.content_record
except AttributeError:
except (AttributeError, ObjectDoesNotExist):
return None
def get_content_html(self, obj):