This commit is contained in:
IGNY8 VPS (Salman)
2025-12-01 08:54:52 +00:00
parent b2012e9563
commit ca5451c795
7 changed files with 196 additions and 8 deletions

View File

@@ -55,6 +55,13 @@ class IntegrationViewSet(SiteSectorModelViewSet):
from rest_framework import serializers
class SiteIntegrationSerializer(serializers.ModelSerializer):
api_key = serializers.SerializerMethodField()
def get_api_key(self, obj):
"""Return the API key from encrypted credentials"""
credentials = obj.get_credentials()
return credentials.get('api_key', '')
def validate(self, data):
"""
Custom validation for WordPress integrations.

View File

@@ -0,0 +1,151 @@
# Generated by Django 5.2.8 on 2025-12-01 08:21
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('planner', '0005_field_rename_implementation'),
('writer', '0010_add_review_status_to_content'),
]
operations = [
migrations.AddField(
model_name='content',
name='external_metadata',
field=models.JSONField(blank=True, default=dict, help_text='External platform metadata (WordPress term IDs, etc.)', null=True),
),
migrations.AddField(
model_name='content',
name='external_type',
field=models.CharField(blank=True, help_text='WordPress post type (post, page, product, etc.)', max_length=100, null=True),
),
migrations.AddField(
model_name='content',
name='meta_description',
field=models.TextField(blank=True, help_text='SEO meta description', null=True),
),
migrations.AddField(
model_name='content',
name='meta_title',
field=models.CharField(blank=True, help_text='SEO meta title', max_length=255, null=True),
),
migrations.AddField(
model_name='content',
name='primary_keyword',
field=models.CharField(blank=True, help_text='Primary SEO keyword', max_length=255, null=True),
),
migrations.AddField(
model_name='content',
name='secondary_keywords',
field=models.JSONField(blank=True, default=list, help_text='Secondary SEO keywords'),
),
migrations.AddField(
model_name='content',
name='sync_status',
field=models.CharField(blank=True, help_text='Sync status with WordPress', max_length=50, null=True),
),
migrations.AddField(
model_name='content',
name='word_count',
field=models.IntegerField(default=0, help_text='Actual word count of content (calculated from HTML)'),
),
migrations.AddField(
model_name='contenttaxonomy',
name='count',
field=models.IntegerField(default=0, help_text='Number of times this term is used'),
),
migrations.AddField(
model_name='contenttaxonomy',
name='description',
field=models.TextField(blank=True, default='', help_text='Taxonomy term description'),
),
migrations.AddField(
model_name='contenttaxonomy',
name='metadata',
field=models.JSONField(blank=True, default=dict, help_text='Additional metadata (AI generation details, etc.)'),
),
migrations.AddField(
model_name='contenttaxonomy',
name='sync_status',
field=models.CharField(blank=True, default='', help_text='Sync status with external platform', max_length=50),
),
migrations.AddField(
model_name='tasks',
name='idea',
field=models.ForeignKey(blank=True, db_column='idea_id', help_text='Optional content idea reference', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='tasks', to='planner.contentideas'),
),
migrations.AlterField(
model_name='content',
name='content_structure',
field=models.CharField(choices=[('article', 'Article'), ('guide', 'Guide'), ('comparison', 'Comparison'), ('review', 'Review'), ('listicle', 'Listicle'), ('landing_page', 'Landing Page'), ('business_page', 'Business Page'), ('service_page', 'Service Page'), ('general', 'General'), ('cluster_hub', 'Cluster Hub'), ('product_page', 'Product Page'), ('category_archive', 'Category Archive'), ('tag_archive', 'Tag Archive'), ('attribute_archive', 'Attribute Archive')], db_index=True, default='article', help_text='Content structure/format based on content type', max_length=50),
),
migrations.AlterField(
model_name='content',
name='content_type',
field=models.CharField(choices=[('post', 'Post'), ('page', 'Page'), ('product', 'Product'), ('taxonomy', 'Taxonomy')], db_index=True, default='post', help_text='Content type: post, page, product, taxonomy', max_length=50),
),
migrations.AlterField(
model_name='contenttaxonomy',
name='external_id',
field=models.IntegerField(blank=True, db_index=True, help_text='WordPress term_id for sync', null=True),
),
migrations.AlterField(
model_name='contenttaxonomy',
name='external_taxonomy',
field=models.CharField(blank=True, default='', help_text='WordPress taxonomy slug (category, post_tag)', max_length=100),
),
migrations.AlterField(
model_name='contenttaxonomy',
name='taxonomy_type',
field=models.CharField(choices=[('category', 'Category'), ('tag', 'Tag')], db_index=True, help_text='Type of taxonomy (category or tag)', max_length=50),
),
migrations.AlterField(
model_name='tasks',
name='content_structure',
field=models.CharField(blank=True, choices=[('article', 'Article'), ('guide', 'Guide'), ('comparison', 'Comparison'), ('review', 'Review'), ('listicle', 'Listicle'), ('landing_page', 'Landing Page'), ('business_page', 'Business Page'), ('service_page', 'Service Page'), ('general', 'General'), ('cluster_hub', 'Cluster Hub'), ('product_page', 'Product Page'), ('category_archive', 'Category Archive'), ('tag_archive', 'Tag Archive'), ('attribute_archive', 'Attribute Archive')], db_index=True, default='article', help_text='Content structure: article, guide, comparison, review, listicle, landing_page, etc.', max_length=100, null=True),
),
migrations.AlterField(
model_name='tasks',
name='content_type',
field=models.CharField(blank=True, choices=[('post', 'Post'), ('page', 'Page'), ('product', 'Product'), ('taxonomy', 'Taxonomy')], db_index=True, default='post', help_text='Content type: post, page, product, taxonomy', max_length=100, null=True),
),
migrations.RemoveField(
model_name='tasks',
name='keywords',
),
migrations.AlterField(
model_name='tasks',
name='taxonomy_term',
field=models.ForeignKey(blank=True, db_column='taxonomy_id', help_text='Optional taxonomy term assignment', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='tasks', to='writer.contenttaxonomy'),
),
migrations.CreateModel(
name='ContentTaxonomyRelation',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('content', models.ForeignKey(db_column='content_id', on_delete=django.db.models.deletion.CASCADE, to='writer.content')),
('taxonomy', models.ForeignKey(db_column='taxonomy_id', on_delete=django.db.models.deletion.CASCADE, to='writer.contenttaxonomy')),
],
options={
'db_table': 'igny8_content_taxonomy_relations',
'unique_together': {('content', 'taxonomy')},
},
),
migrations.AlterField(
model_name='content',
name='taxonomy_terms',
field=models.ManyToManyField(blank=True, help_text='Associated taxonomy terms (categories, tags, attributes)', related_name='contents', through='writer.ContentTaxonomyRelation', to='writer.contenttaxonomy'),
),
migrations.DeleteModel(
name='ContentTaxonomyMap',
),
migrations.AddField(
model_name='tasks',
name='keywords',
field=models.TextField(blank=True, help_text='Comma-separated keywords for this task', null=True),
),
]