from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site


def initialize_site():
    """
    For development environments, set up the Site and home page objects.
    """
    try:
        site = Site.objects.get(id=settings.SITE_ID)
        # If the default site was already created, just update its properties
        site.domain = "webquills.com"
        site.name = "WebQuills"
    except Site.DoesNotExist:
        site = Site.objects.create(
            id=settings.SITE_ID,
            domain="webquills.com",
            name="WebQuills",
        )

    site.save()

from django.conf import settings
from django.contrib.sites.models import Site

from webquills.core.models import SiteMeta


def initialize_site():
    """
    For development environments, set up the Site and home page objects.
    """
    try:
        site = Site.objects.get(id=settings.SITE_ID)
        # If the default site was already created, just update its properties
        site.domain = "webquills.com"
        site.name = "WebQuills"
    except Site.DoesNotExist:
        site = Site.objects.create(
            id=settings.SITE_ID,
            domain="webquills.com",
            name="WebQuills",
        )
    if not hasattr(site, "meta"):
        SiteMeta.objects.create(site=site)
    site.save()

Create SiteMeta for default site
Create SiteMeta for default site

  from django.conf import settings
- from django.contrib.contenttypes.models import ContentType
  from django.contrib.sites.models import Site
+ 
+ from webquills.core.models import SiteMeta
  
  
  def initialize_site():
      """
      For development environments, set up the Site and home page objects.
      """
      try:
          site = Site.objects.get(id=settings.SITE_ID)
          # If the default site was already created, just update its properties
          site.domain = "webquills.com"
          site.name = "WebQuills"
      except Site.DoesNotExist:
          site = Site.objects.create(
              id=settings.SITE_ID,
              domain="webquills.com",
              name="WebQuills",
          )
- 
+     if not hasattr(site, "meta"):
+         SiteMeta.objects.create(site=site)
      site.save()
  
Create SiteMeta for default site
## Code Before:
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site


def initialize_site():
    """
    For development environments, set up the Site and home page objects.
    """
    try:
        site = Site.objects.get(id=settings.SITE_ID)
        # If the default site was already created, just update its properties
        site.domain = "webquills.com"
        site.name = "WebQuills"
    except Site.DoesNotExist:
        site = Site.objects.create(
            id=settings.SITE_ID,
            domain="webquills.com",
            name="WebQuills",
        )

    site.save()

## Instruction:
Create SiteMeta for default site
## Code After:
from django.conf import settings
from django.contrib.sites.models import Site

from webquills.core.models import SiteMeta


def initialize_site():
    """
    For development environments, set up the Site and home page objects.
    """
    try:
        site = Site.objects.get(id=settings.SITE_ID)
        # If the default site was already created, just update its properties
        site.domain = "webquills.com"
        site.name = "WebQuills"
    except Site.DoesNotExist:
        site = Site.objects.create(
            id=settings.SITE_ID,
            domain="webquills.com",
            name="WebQuills",
        )
    if not hasattr(site, "meta"):
        SiteMeta.objects.create(site=site)
    site.save()
