# Path: djangoblog/utils.py
# def get_max_articleid_commentid():
# def get_sha256(str):
# def cache_decorator(expiration=3 * 60):
#     def wrapper(func):
#         def news(*args, **kwargs):
# def expire_view_cache(path, servername, serverport, key_prefix=None):
# def get_current_site():
#     def _convert_markdown(value):
#     def get_markdown_with_toc(value):
#     def get_markdown(value):
# def send_email(emailto, title, content):
# def generate_code() -> str:
# def parse_dict_to_url(dict):
# def get_blog_setting():
# def save_user_avatar(url):
# def delete_sidebar_cache():
# def delete_view_cache(prefix, keys):
# class CommonMarkdown:
# 
# Path: djangoblog/utils.py
# @cache_decorator()
# def get_current_site():
#     site = Site.objects.get_current()
#     return site


import logging
from abc import abstractmethod
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.urls import reverse
from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _
from mdeditor.fields import MDTextField
from uuslug import slugify
from djangoblog.utils import cache_decorator, cache
from djangoblog.utils import get_current_site
        from djangoblog.utils import cache
        null=False,
        blank=False,
        default='')
    show_gongan_code = models.BooleanField(
        '是否显示公安备案号', default=False, null=False)
    gongan_beiancode = models.TextField(
        '公安备案号',
        max_length=2000,
        null=True,
        blank=True,
        default='')
    resource_path = models.CharField(
        "静态文件保存地址",
        max_length=300,
        null=False,
        default='/var/www/resource/')

    class Meta:
        verbose_name = '网站配置'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.sitename

    def clean(self):
        if BlogSettings.objects.exclude(id=self.id).count():
            raise ValidationError(_('只能有一个配置'))

    def save(self, *args, **kwargs):
        super().save(*args, **kwargs)

# Path: djangoblog/utils.py
# def get_max_articleid_commentid():
# def get_sha256(str):
# def cache_decorator(expiration=3 * 60):
#     def wrapper(func):
#         def news(*args, **kwargs):
# def expire_view_cache(path, servername, serverport, key_prefix=None):
# def get_current_site():
#     def _convert_markdown(value):
#     def get_markdown_with_toc(value):
#     def get_markdown(value):
# def send_email(emailto, title, content):
# def generate_code() -> str:
# def parse_dict_to_url(dict):
# def get_blog_setting():
# def save_user_avatar(url):
# def delete_sidebar_cache():
# def delete_view_cache(prefix, keys):
# class CommonMarkdown:
# 
# Path: djangoblog/utils.py
# @cache_decorator()
# def get_current_site():
#     site = Site.objects.get_current()
#     return site


# Path: blog/models.py
import logging
from abc import abstractmethod
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.urls import reverse
from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _
from mdeditor.fields import MDTextField
from uuslug import slugify
from djangoblog.utils import cache_decorator, cache
from djangoblog.utils import get_current_site
        from djangoblog.utils import cache

        null=False,
        blank=False,
        default='')
    show_gongan_code = models.BooleanField(
        '是否显示公安备案号', default=False, null=False)
    gongan_beiancode = models.TextField(
        '公安备案号',
        max_length=2000,
        null=True,
        blank=True,
        default='')
    resource_path = models.CharField(
        "静态文件保存地址",
        max_length=300,
        null=False,
        default='/var/www/resource/')

    class Meta:
        verbose_name = '网站配置'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.sitename

    def clean(self):
        if BlogSettings.objects.exclude(id=self.id).count():
            raise ValidationError(_('只能有一个配置'))

    def save(self, *args, **kwargs):
        super().save(*args, **kwargs)

        cache.clear()