# Path: pages/conf.py
# class PagesAppConf(AppConf):
#     class Meta:
#     DEFAULT_LANGUAGE = getattr(settings, 'PAGES_DEFAULT_LANGUAGE', 'en')
#     USE_FALLBACK_LANGUAGE = getattr(settings, 'PAGES_USE_FALLBACK_LANGUAGE', True)
#     FALLBACK_LANGUAGE = getattr(settings, 'PAGES_FALLBACK_LANGUAGE', 'en')
#     FALLBACK_LANGUAGE_COOKIE_NAME = getattr(settings, 'PAGES_FALLBACK_LANGUAGE', 'pages_fallback_language')
#     ALLOW_DJANGO_TEMPLATES = getattr(settings, 'PAGES_ALLOW_DJANGO_TEMPLATES', False)
#     USE_SITE_ID = getattr(settings, 'PAGES_USE_SITE_ID', False)
#     HIDE_SITES = getattr(settings, 'PAGES_HIDE_SITES', True)
#     DEFAULT_TEMPLATE = getattr(settings, 'PAGES_DEFAULT_TEMPLATE', 'pages/page.html')
#     RAISE_403 = getattr(settings, 'PAGES_RAISE_403', True)
#     RENDER_403 = getattr(settings, 'PAGES_RENDER_403', False)
#     TEMPLATE_403 = getattr(settings, 'PAGES_TEMPLATE_403', 'pages/403.html')
#     PAGE_SLUG_NAME = getattr(settings, 'PAGES_PAGE_SLUG_NAME', 'slug')
#     HOME_PAGE_SLUG = getattr(settings, 'PAGES_HOME_PAGE_SLUG', 'home')
#     CACHE_BACKEND = getattr(settings, 'PAGES_CACHE_BACKEND', 'default')
#     CACHE_PREFIX = getattr(settings, 'PAGES_CACHE_PREFIX', 'pages_')
#     CACHE_DELETE = getattr(settings, 'PAGES_CACHE_DELETE', False)
#     PAGE_CACHE_KEY = getattr(settings, 'PAGES_PAGE_CACHE_KEY', 'page_cache_key_')
#     PAGE_VERSION_KEY = getattr(settings, 'PAGES_PAGE_VERSION_KEY', 'page_version_key_')
#     PAGE_CACHE_TIMEOUT = getattr(settings, 'PAGES_PAGE_CACHE_TIMEOUT', 31536000)  # timeout 1 year by default
#     PAGE_HTTP_MAX_AGE = getattr(settings, 'PAGES_PAGE_CACHE_TIMEOUT', 3600)  # timeout 1 hour by default
#     PAGE_USE_EXT_CONTENT_TYPES = getattr(settings, 'PAGES_PAGE_USE_EXT_CONTENT_TYPES', False)
#     PAGE_EXT_CONTENT_TYPES = getattr(settings, 'PAGES_PAGE_EXT_CONTENT_TYPES', None)
#     PAGE_EXT_CONTENT_INLINES = getattr(settings, 'PAGES_PAGE_EXT_CONTENT_INLINES', None)
#     PAGE_USE_META_TITLE_FOR_SLUG = getattr(settings, 'PAGES_PAGE_USE_META_TITLE_FOR_SLUG', True)
#     PAGE_ACTIVE_CSS_CLASS = getattr(settings, 'PAGES_PAGE_ACTIVE_CSS_CLASS', 'active')
# 
# Path: pages/models/pagebasecontent.py
# class PageBaseContent(models.Model):
#     type = models.CharField(_('Type'), choices=get_all_content_tuple(), max_length=100, blank=False, db_index=True)
#     page = models.ForeignKey('pages.Page', verbose_name=_('Page'))
#     language = models.CharField(max_length=5, default=str(settings.PAGES_DEFAULT_LANGUAGE))
#     sid = models.CharField(max_length=200, unique=True)
#     name = models.CharField(max_length=200, blank=True, unique=True)
#     is_extended = models.BooleanField(_('Extended?'), default=False)
#     comment = models.CharField(max_length=250, blank=True)
#     date_created = models.DateTimeField(_('Created'), default=timezone.now)
#     date_updated = models.DateTimeField(_('Updated'), default=timezone.now)
#     created_by = models.ForeignKey(
#         settings.AUTH_USER_MODEL, related_name='%(app_label)s_%(class)s_creator', null=True
#     )
#     updated_by = models.ForeignKey(
#         settings.AUTH_USER_MODEL, related_name='%(app_label)s_%(class)s_editor', null=True
#     )
# 
#     def __str__(self):
#         """id string of instance"""
#         return '{0:>s}'.format(self.sid)
# 
#     def count_objects(self, use_lang=True):
#         if use_lang:
#             count = self.__class__.objects.filter(page=self.page, language=self.language).count()
#         else:
#             count = self.__class__.objects.filter(page=self.page).count()
#         return count
# 
#     def update_fields(self, change):
#         pass
# 
#     def save(self, *args, **kwargs):
#         """Override the default ``save`` method."""
# 
#         if self.pk is None:
#             self.created_by = self.page.created_by
#             self.update_fields(False)
#             count = self.count_objects() + 1
#         else:
#             self.update_fields(True)
#             count = int(self.sid.split(':')[-1])
#         self.sid = '{0:>s}:{1:>s}:{2:>s}:{3:>d}'.format(self.language, self.page.name, self.type, count)
#         self.name = self.name if len(self.name) else self.sid
#         self.updated_by = self.page.updated_by
# 
#         # Call parent's ``save`` method
#         super(PageBaseContent, self).save(*args, **kwargs)
# 
#     class Meta:
#         abstract = True
# 
#     class PageMeta:
#         def __init__(self):
#             self.context_name = 'base'
#             self.multiple_per_page = True
#             self.multiple_per_locale = True


import importlib
import slugify
import itertools
from django.db import models
from django.utils.translation import ugettext_lazy as _
from markitup.fields import MarkupField
from pages.conf import settings
from pages.models.pagebasecontent import PageBaseContent
            from django.core.exceptions import ImproperlyConfigured
"""Implements page content models"""

from __future__ import unicode_literals




PAGE_EXT_CONTENT_TYPES = []
PAGE_MAX_SLUG_LENGTH = 245


# Path: pages/conf.py
# class PagesAppConf(AppConf):
#     class Meta:
#     DEFAULT_LANGUAGE = getattr(settings, 'PAGES_DEFAULT_LANGUAGE', 'en')
#     USE_FALLBACK_LANGUAGE = getattr(settings, 'PAGES_USE_FALLBACK_LANGUAGE', True)
#     FALLBACK_LANGUAGE = getattr(settings, 'PAGES_FALLBACK_LANGUAGE', 'en')
#     FALLBACK_LANGUAGE_COOKIE_NAME = getattr(settings, 'PAGES_FALLBACK_LANGUAGE', 'pages_fallback_language')
#     ALLOW_DJANGO_TEMPLATES = getattr(settings, 'PAGES_ALLOW_DJANGO_TEMPLATES', False)
#     USE_SITE_ID = getattr(settings, 'PAGES_USE_SITE_ID', False)
#     HIDE_SITES = getattr(settings, 'PAGES_HIDE_SITES', True)
#     DEFAULT_TEMPLATE = getattr(settings, 'PAGES_DEFAULT_TEMPLATE', 'pages/page.html')
#     RAISE_403 = getattr(settings, 'PAGES_RAISE_403', True)
#     RENDER_403 = getattr(settings, 'PAGES_RENDER_403', False)
#     TEMPLATE_403 = getattr(settings, 'PAGES_TEMPLATE_403', 'pages/403.html')
#     PAGE_SLUG_NAME = getattr(settings, 'PAGES_PAGE_SLUG_NAME', 'slug')
#     HOME_PAGE_SLUG = getattr(settings, 'PAGES_HOME_PAGE_SLUG', 'home')
#     CACHE_BACKEND = getattr(settings, 'PAGES_CACHE_BACKEND', 'default')
#     CACHE_PREFIX = getattr(settings, 'PAGES_CACHE_PREFIX', 'pages_')
#     CACHE_DELETE = getattr(settings, 'PAGES_CACHE_DELETE', False)
#     PAGE_CACHE_KEY = getattr(settings, 'PAGES_PAGE_CACHE_KEY', 'page_cache_key_')
#     PAGE_VERSION_KEY = getattr(settings, 'PAGES_PAGE_VERSION_KEY', 'page_version_key_')
#     PAGE_CACHE_TIMEOUT = getattr(settings, 'PAGES_PAGE_CACHE_TIMEOUT', 31536000)  # timeout 1 year by default
#     PAGE_HTTP_MAX_AGE = getattr(settings, 'PAGES_PAGE_CACHE_TIMEOUT', 3600)  # timeout 1 hour by default
#     PAGE_USE_EXT_CONTENT_TYPES = getattr(settings, 'PAGES_PAGE_USE_EXT_CONTENT_TYPES', False)
#     PAGE_EXT_CONTENT_TYPES = getattr(settings, 'PAGES_PAGE_EXT_CONTENT_TYPES', None)
#     PAGE_EXT_CONTENT_INLINES = getattr(settings, 'PAGES_PAGE_EXT_CONTENT_INLINES', None)
#     PAGE_USE_META_TITLE_FOR_SLUG = getattr(settings, 'PAGES_PAGE_USE_META_TITLE_FOR_SLUG', True)
#     PAGE_ACTIVE_CSS_CLASS = getattr(settings, 'PAGES_PAGE_ACTIVE_CSS_CLASS', 'active')
# 
# Path: pages/models/pagebasecontent.py
# class PageBaseContent(models.Model):
#     type = models.CharField(_('Type'), choices=get_all_content_tuple(), max_length=100, blank=False, db_index=True)
#     page = models.ForeignKey('pages.Page', verbose_name=_('Page'))
#     language = models.CharField(max_length=5, default=str(settings.PAGES_DEFAULT_LANGUAGE))
#     sid = models.CharField(max_length=200, unique=True)
#     name = models.CharField(max_length=200, blank=True, unique=True)
#     is_extended = models.BooleanField(_('Extended?'), default=False)
#     comment = models.CharField(max_length=250, blank=True)
#     date_created = models.DateTimeField(_('Created'), default=timezone.now)
#     date_updated = models.DateTimeField(_('Updated'), default=timezone.now)
#     created_by = models.ForeignKey(
#         settings.AUTH_USER_MODEL, related_name='%(app_label)s_%(class)s_creator', null=True
#     )
#     updated_by = models.ForeignKey(
#         settings.AUTH_USER_MODEL, related_name='%(app_label)s_%(class)s_editor', null=True
#     )
# 
#     def __str__(self):
#         """id string of instance"""
#         return '{0:>s}'.format(self.sid)
# 
#     def count_objects(self, use_lang=True):
#         if use_lang:
#             count = self.__class__.objects.filter(page=self.page, language=self.language).count()
#         else:
#             count = self.__class__.objects.filter(page=self.page).count()
#         return count
# 
#     def update_fields(self, change):
#         pass
# 
#     def save(self, *args, **kwargs):
#         """Override the default ``save`` method."""
# 
#         if self.pk is None:
#             self.created_by = self.page.created_by
#             self.update_fields(False)
#             count = self.count_objects() + 1
#         else:
#             self.update_fields(True)
#             count = int(self.sid.split(':')[-1])
#         self.sid = '{0:>s}:{1:>s}:{2:>s}:{3:>d}'.format(self.language, self.page.name, self.type, count)
#         self.name = self.name if len(self.name) else self.sid
#         self.updated_by = self.page.updated_by
# 
#         # Call parent's ``save`` method
#         super(PageBaseContent, self).save(*args, **kwargs)
# 
#     class Meta:
#         abstract = True
# 
#     class PageMeta:
#         def __init__(self):
#             self.context_name = 'base'
#             self.multiple_per_page = True
#             self.multiple_per_locale = True


# Path: pages/models/pagecontenttypes.py
import importlib
import slugify
import itertools
from django.db import models
from django.utils.translation import ugettext_lazy as _
from markitup.fields import MarkupField
from pages.conf import settings
from pages.models.pagebasecontent import PageBaseContent
            from django.core.exceptions import ImproperlyConfigured

"""Implements page content models"""

from __future__ import unicode_literals




PAGE_EXT_CONTENT_TYPES = []
PAGE_MAX_SLUG_LENGTH = 245


if settings.PAGES_PAGE_USE_EXT_CONTENT_TYPES: