# Path: djangocms_blog/cms_appconfig.py
# class BlogConfig(TranslatableModel, AppHookConfig):
#     """
#     Adds translatable, per-app-instance fields.
#     """
# 
#     translations = TranslatedFields(
#         app_title=models.CharField(_("application title"), max_length=234),
#         object_name=models.CharField(_("object name"), max_length=234, default=get_setting("DEFAULT_OBJECT_NAME")),
#     )
# 
#     class Meta:
#         verbose_name = _("blog config")
#         verbose_name_plural = _("blog configs")
# 
#     def get_app_title(self):
#         return getattr(self, "app_title", _("untitled"))
# 
#     @property
#     def schemaorg_type(self):
#         """Compatibility shim to fetch data from legacy gplus_type field."""
#         return self.gplus_type
# 
# Path: djangocms_blog/fields.py
# def slugify(base):
#     return django_slugify(base, allow_unicode=True)
# 
# Path: djangocms_blog/managers.py
# class GenericDateTaggedManager(TaggedFilterItem, AppHookConfigTranslatableManager):
#     use_for_related_fields = True
# 
#     queryset_class = GenericDateQuerySet
# 
#     def get_queryset(self, *args, **kwargs):
#         return super().get_queryset(*args, **kwargs)
# 
#     def published(self, current_site=True):
#         return self.get_queryset().published(current_site)
# 
#     def available(self, current_site=True):
#         return self.get_queryset().available(current_site)
# 
#     def archived(self, current_site=True):
#         return self.get_queryset().archived(current_site)
# 
#     def published_future(self, current_site=True):
#         return self.get_queryset().published_future(current_site)
# 
#     def filter_by_language(self, language, current_site=True):
#         return self.get_queryset().filter_by_language(language, current_site)
# 
#     def on_site(self, site=None):
#         return self.get_queryset().on_site(site)
# 
#     def get_months(self, queryset=None, current_site=True):
#         """
#         Get months with aggregate count (how much posts is in the month).
#         Results are ordered by date.
#         """
#         if queryset is None:
#             queryset = self.get_queryset()
#         if current_site:
#             queryset = queryset.on_site()
#         dates_qs = queryset.values_list(queryset.start_date_field, queryset.fallback_date_field)
#         dates = []
#         for blog_dates in dates_qs:
#             if blog_dates[0]:
#                 current_date = blog_dates[0]
#             else:
#                 current_date = blog_dates[1]
#             dates.append(
#                 (
#                     current_date.year,
#                     current_date.month,
#                 )
#             )
#         date_counter = Counter(dates)
#         dates = set(dates)
#         dates = sorted(dates, reverse=True)
#         return [
#             {"date": now().replace(year=year, month=month, day=1), "count": date_counter[year, month]}
#             for year, month in dates
#         ]
# 
# Path: djangocms_blog/settings.py
# def get_setting(name):
#     """Get setting value from django settings with fallback to globals defaults."""
#     from django.conf import settings
# 
#     return getattr(settings, "BLOG_%s" % name, params["BLOG_%s" % name])


import hashlib
from aldryn_apphooks_config.fields import AppHookConfigField
from aldryn_apphooks_config.managers.parler import AppHookConfigTranslatableManager
from cms.models import CMSPlugin, PlaceholderField
from django.conf import settings as dj_settings
from django.contrib.auth import get_user_model
from django.contrib.sites.shortcuts import get_current_site
from django.core.cache import cache
from django.db import models
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from django.urls import reverse
from django.utils import timezone
from django.utils.encoding import force_bytes, force_str
from django.utils.functional import cached_property
from django.utils.html import escape, strip_tags
from django.utils.translation import get_language, gettext, gettext_lazy as _
from djangocms_text_ckeditor.fields import HTMLField
from filer.fields.image import FilerImageField
from filer.models import ThumbnailOption
from meta.models import ModelMeta
from parler.models import TranslatableModel, TranslatedFields
from parler.utils.context import switch_language
from sortedm2m.fields import SortedManyToManyField
from taggit_autosuggest.managers import TaggableManager
from .cms_appconfig import BlogConfig
from .fields import slugify
from .managers import GenericDateTaggedManager
from .settings import get_setting
    from knocker.mixins import KnockerModel
    )
    main_image_thumbnail = models.ForeignKey(
        thumbnail_model,
        verbose_name=_("main image thumbnail"),
        related_name="djangocms_blog_post_thumbnail",
        on_delete=models.SET_NULL,
        blank=True,
        null=True,
    )
    main_image_full = models.ForeignKey(
        thumbnail_model,
        verbose_name=_("main image full"),
        related_name="djangocms_blog_post_full",
        on_delete=models.SET_NULL,
        blank=True,
        null=True,
    )
    enable_comments = models.BooleanField(
        verbose_name=_("enable comments on post"), default=get_setting("ENABLE_COMMENTS")
    )
    sites = models.ManyToManyField(
        "sites.Site",
        verbose_name=_("Site(s)"),
        blank=True,
        help_text=_(
            "Select sites in which to show the post. "
            "If none is set it will be "
            "visible in all the configured sites."
        ),
    )

# Path: djangocms_blog/cms_appconfig.py
# class BlogConfig(TranslatableModel, AppHookConfig):
#     """
#     Adds translatable, per-app-instance fields.
#     """
# 
#     translations = TranslatedFields(
#         app_title=models.CharField(_("application title"), max_length=234),
#         object_name=models.CharField(_("object name"), max_length=234, default=get_setting("DEFAULT_OBJECT_NAME")),
#     )
# 
#     class Meta:
#         verbose_name = _("blog config")
#         verbose_name_plural = _("blog configs")
# 
#     def get_app_title(self):
#         return getattr(self, "app_title", _("untitled"))
# 
#     @property
#     def schemaorg_type(self):
#         """Compatibility shim to fetch data from legacy gplus_type field."""
#         return self.gplus_type
# 
# Path: djangocms_blog/fields.py
# def slugify(base):
#     return django_slugify(base, allow_unicode=True)
# 
# Path: djangocms_blog/managers.py
# class GenericDateTaggedManager(TaggedFilterItem, AppHookConfigTranslatableManager):
#     use_for_related_fields = True
# 
#     queryset_class = GenericDateQuerySet
# 
#     def get_queryset(self, *args, **kwargs):
#         return super().get_queryset(*args, **kwargs)
# 
#     def published(self, current_site=True):
#         return self.get_queryset().published(current_site)
# 
#     def available(self, current_site=True):
#         return self.get_queryset().available(current_site)
# 
#     def archived(self, current_site=True):
#         return self.get_queryset().archived(current_site)
# 
#     def published_future(self, current_site=True):
#         return self.get_queryset().published_future(current_site)
# 
#     def filter_by_language(self, language, current_site=True):
#         return self.get_queryset().filter_by_language(language, current_site)
# 
#     def on_site(self, site=None):
#         return self.get_queryset().on_site(site)
# 
#     def get_months(self, queryset=None, current_site=True):
#         """
#         Get months with aggregate count (how much posts is in the month).
#         Results are ordered by date.
#         """
#         if queryset is None:
#             queryset = self.get_queryset()
#         if current_site:
#             queryset = queryset.on_site()
#         dates_qs = queryset.values_list(queryset.start_date_field, queryset.fallback_date_field)
#         dates = []
#         for blog_dates in dates_qs:
#             if blog_dates[0]:
#                 current_date = blog_dates[0]
#             else:
#                 current_date = blog_dates[1]
#             dates.append(
#                 (
#                     current_date.year,
#                     current_date.month,
#                 )
#             )
#         date_counter = Counter(dates)
#         dates = set(dates)
#         dates = sorted(dates, reverse=True)
#         return [
#             {"date": now().replace(year=year, month=month, day=1), "count": date_counter[year, month]}
#             for year, month in dates
#         ]
# 
# Path: djangocms_blog/settings.py
# def get_setting(name):
#     """Get setting value from django settings with fallback to globals defaults."""
#     from django.conf import settings
# 
#     return getattr(settings, "BLOG_%s" % name, params["BLOG_%s" % name])


# Path: djangocms_blog/models.py
import hashlib
from aldryn_apphooks_config.fields import AppHookConfigField
from aldryn_apphooks_config.managers.parler import AppHookConfigTranslatableManager
from cms.models import CMSPlugin, PlaceholderField
from django.conf import settings as dj_settings
from django.contrib.auth import get_user_model
from django.contrib.sites.shortcuts import get_current_site
from django.core.cache import cache
from django.db import models
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from django.urls import reverse
from django.utils import timezone
from django.utils.encoding import force_bytes, force_str
from django.utils.functional import cached_property
from django.utils.html import escape, strip_tags
from django.utils.translation import get_language, gettext, gettext_lazy as _
from djangocms_text_ckeditor.fields import HTMLField
from filer.fields.image import FilerImageField
from filer.models import ThumbnailOption
from meta.models import ModelMeta
from parler.models import TranslatableModel, TranslatedFields
from parler.utils.context import switch_language
from sortedm2m.fields import SortedManyToManyField
from taggit_autosuggest.managers import TaggableManager
from .cms_appconfig import BlogConfig
from .fields import slugify
from .managers import GenericDateTaggedManager
from .settings import get_setting
    from knocker.mixins import KnockerModel

    )
    main_image_thumbnail = models.ForeignKey(
        thumbnail_model,
        verbose_name=_("main image thumbnail"),
        related_name="djangocms_blog_post_thumbnail",
        on_delete=models.SET_NULL,
        blank=True,
        null=True,
    )
    main_image_full = models.ForeignKey(
        thumbnail_model,
        verbose_name=_("main image full"),
        related_name="djangocms_blog_post_full",
        on_delete=models.SET_NULL,
        blank=True,
        null=True,
    )
    enable_comments = models.BooleanField(
        verbose_name=_("enable comments on post"), default=get_setting("ENABLE_COMMENTS")
    )
    sites = models.ManyToManyField(
        "sites.Site",
        verbose_name=_("Site(s)"),
        blank=True,
        help_text=_(
            "Select sites in which to show the post. "
            "If none is set it will be "
            "visible in all the configured sites."
        ),
    )

    app_config = AppHookConfigField(BlogConfig, null=True, verbose_name=_("app. config"))