modified cms integrate to support separate content for each domain

This commit is contained in:
Arvind Tiwari 2018-04-03 22:41:29 +05:30
commit d843c34d68
10 changed files with 105 additions and 24 deletions

View file

@ -1,3 +1,4 @@
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand
from datacenterlight.cms_models import CMSIntegration
@ -6,8 +7,16 @@ class Command(BaseCommand):
help = '''Creates cms integration objects for datacenterlight'''
def handle(self, *args, **options):
obj, created = CMSIntegration.objects.get_or_create(name='default')
self.create_cms_integration()
def create_cms_integration(self, site=None):
obj, created = CMSIntegration.objects.get_or_create(
name='default', domain=site
)
domain_name = site.domain if site else 'All Sites'
if created:
print('created the default CMSIntegration object')
print('created the default CMSIntegration object for', domain_name)
else:
print('default CMSIntegration object already exists')
print(
'default CMSIntegration object already exists for', domain_name
)