1
This commit is contained in:
87
backend/inject_test_data.py
Normal file
87
backend/inject_test_data.py
Normal file
@@ -0,0 +1,87 @@
|
||||
"""
|
||||
Django Management Command to Manually Add WordPress Structure Data
|
||||
Run this in Django shell or as a management command
|
||||
"""
|
||||
|
||||
from igny8_core.business.integration.models import SiteIntegration
|
||||
from igny8_core.auth.models import Site
|
||||
from django.utils import timezone
|
||||
|
||||
# Get site 5
|
||||
site = Site.objects.get(id=5)
|
||||
print(f"Site: {site.name}")
|
||||
|
||||
# Get or create WordPress integration for this site
|
||||
integration, created = SiteIntegration.objects.get_or_create(
|
||||
site=site,
|
||||
platform='wordpress',
|
||||
defaults={
|
||||
'is_active': True,
|
||||
'sync_enabled': True,
|
||||
'config_json': {}
|
||||
}
|
||||
)
|
||||
|
||||
print(f"Integration: {integration.id} (created: {created})")
|
||||
|
||||
# Add structure data
|
||||
integration.config_json = {
|
||||
'content_types': {
|
||||
'post_types': {
|
||||
'post': {
|
||||
'label': 'Posts',
|
||||
'count': 150,
|
||||
'enabled': True,
|
||||
'fetch_limit': 100,
|
||||
'synced_count': 0
|
||||
},
|
||||
'page': {
|
||||
'label': 'Pages',
|
||||
'count': 25,
|
||||
'enabled': True,
|
||||
'fetch_limit': 100,
|
||||
'synced_count': 0
|
||||
},
|
||||
'product': {
|
||||
'label': 'Products',
|
||||
'count': 89,
|
||||
'enabled': True,
|
||||
'fetch_limit': 100,
|
||||
'synced_count': 0
|
||||
}
|
||||
},
|
||||
'taxonomies': {
|
||||
'category': {
|
||||
'label': 'Categories',
|
||||
'count': 15,
|
||||
'enabled': True,
|
||||
'fetch_limit': 100,
|
||||
'synced_count': 0
|
||||
},
|
||||
'post_tag': {
|
||||
'label': 'Tags',
|
||||
'count': 234,
|
||||
'enabled': True,
|
||||
'fetch_limit': 100,
|
||||
'synced_count': 0
|
||||
},
|
||||
'product_cat': {
|
||||
'label': 'Product Categories',
|
||||
'count': 12,
|
||||
'enabled': True,
|
||||
'fetch_limit': 100,
|
||||
'synced_count': 0
|
||||
}
|
||||
},
|
||||
'last_structure_fetch': timezone.now().isoformat()
|
||||
},
|
||||
'plugin_connection_enabled': True,
|
||||
'two_way_sync_enabled': True
|
||||
}
|
||||
|
||||
integration.save()
|
||||
print("✓ Structure data saved!")
|
||||
print(f"Integration ID: {integration.id}")
|
||||
print(f"Content Types: {len(integration.config_json['content_types']['post_types'])} post types, {len(integration.config_json['content_types']['taxonomies'])} taxonomies")
|
||||
print("\nNow refresh: https://app.igny8.com/sites/5/settings?tab=content-types")
|
||||
|
||||
Reference in New Issue
Block a user