# Path: website/jdpages/views.py
# def get_homepage_header():
#     """ Returns the page header image of the homepage """
#     homepage_id = get_homepage_id()
#     if homepage_id is None:
#         return None
#     return get_page_header(homepage_id)
# 
# Path: website/jdpages/models.py
# class Footer(SiteRelated):
#     links_left = models.OneToOneField(FooterLinks, auto_created=True, related_name="links_left")
#     links_middle = models.OneToOneField(FooterLinks, auto_created=True, related_name="links_right")
#     info_right = models.OneToOneField(FooterInfo, auto_created=True)
# 
#     class Meta:
#         verbose_name = "Footer"
#         verbose_name_plural = "Footer"


import logging
from django.contrib.sites.models import Site
from mezzanine.conf import settings
from website.jdpages.views import get_homepage_header
from website.jdpages.models import Footer




logger = logging.getLogger(__name__)


def site_properties(request):
    """ :returns: basic site properties """
    if not hasattr(request, '__main_site_url'):
        try:
            dom = Site.objects.values_list('domain', flat=True).get(pk=1)
            request.__main_site_url = 'http://' + dom
        except Site.DoesNotExist:
            return {}

    footer = None
    if Footer.objects.exists():

# Path: website/jdpages/views.py
# def get_homepage_header():
#     """ Returns the page header image of the homepage """
#     homepage_id = get_homepage_id()
#     if homepage_id is None:
#         return None
#     return get_page_header(homepage_id)
# 
# Path: website/jdpages/models.py
# class Footer(SiteRelated):
#     links_left = models.OneToOneField(FooterLinks, auto_created=True, related_name="links_left")
#     links_middle = models.OneToOneField(FooterLinks, auto_created=True, related_name="links_right")
#     info_right = models.OneToOneField(FooterInfo, auto_created=True)
# 
#     class Meta:
#         verbose_name = "Footer"
#         verbose_name_plural = "Footer"


# Path: website/jdpages/context_processors.py
import logging
from django.contrib.sites.models import Site
from mezzanine.conf import settings
from website.jdpages.views import get_homepage_header
from website.jdpages.models import Footer





logger = logging.getLogger(__name__)


def site_properties(request):
    """ :returns: basic site properties """
    if not hasattr(request, '__main_site_url'):
        try:
            dom = Site.objects.values_list('domain', flat=True).get(pk=1)
            request.__main_site_url = 'http://' + dom
        except Site.DoesNotExist:
            return {}

    footer = None
    if Footer.objects.exists():

        footer = Footer.objects.all()[0]