diff --git a/app/cybercode/settings.py b/app/cybercode/settings.py index ca31e50..84d81a0 100644 --- a/app/cybercode/settings.py +++ b/app/cybercode/settings.py @@ -139,7 +139,7 @@ customColorPalette = [ }, ] -# CKEDITOR_5_CUSTOM_CSS = 'css/ckeditor-font-color.css' # optional +# CKEDITOR_5_CUSTOM_CSS = 'app/static/cybercode/styles/editor.css' # optional # CKEDITOR_5_FILE_STORAGE = "path_to_storage.CustomStorage" # optional CKEDITOR_5_CONFIGS = { 'simple': { @@ -148,6 +148,7 @@ CKEDITOR_5_CONFIGS = { 'default': { 'toolbar': ['heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'imageUpload', ], + 'contentsCss': ['/static/cybercode/styles/editor.css'], 'language': 'ru', }, diff --git a/app/static/cybercode/styles/editor.css b/app/static/cybercode/styles/editor.css new file mode 100644 index 0000000..1fa226c --- /dev/null +++ b/app/static/cybercode/styles/editor.css @@ -0,0 +1,21 @@ +/*!* Пример кастомизации *!*/ +/*.ck-content {*/ +/* font-family: 'Arial', sans-serif;*/ +/* font-size: 48px;*/ +/* line-height: 1.6;*/ +/* color: #333;*/ +/*}*/ + +/*.ck-content h2 {*/ +/* color: #2c3e50;*/ +/* font-size: 24px;*/ +/* margin-top: 20px;*/ +/* margin-bottom: 10px;*/ +/*}*/ + +/*.ck-content p {*/ +/* color: #3498db;*/ +/* font-size: 24px;*/ +/* margin-top: 20px;*/ +/* margin-bottom: 10px;*/ +/*}*/ \ No newline at end of file diff --git a/app/static/cybercode/styles/style.css b/app/static/cybercode/styles/style.css index 77b03e3..5d52436 100644 --- a/app/static/cybercode/styles/style.css +++ b/app/static/cybercode/styles/style.css @@ -511,4 +511,18 @@ a.service-slide { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; -} \ No newline at end of file +} + +.ck-content h1 { + font-size: 2.5em; + margin-top: 1.5em; + margin-bottom: 0.5em; + color: #333; + font-weight: bold; +} +.ck-content p { + margin-top: 1em; + margin-bottom: 1em; + text-indent: 20px; +} + diff --git a/app/templates/base.html b/app/templates/base.html index 6fbd136..c0d7c36 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -19,6 +19,7 @@ + {% block title %} Кибекод {% endblock %} diff --git a/app/website/validators/validate_file_extension.py b/app/website/validators/validate_file_extension.py index f508587..04a3fd1 100644 --- a/app/website/validators/validate_file_extension.py +++ b/app/website/validators/validate_file_extension.py @@ -1,16 +1,24 @@ -def validate_file_extension_mp4(value): - import os - from django.core.exceptions import ValidationError - ext = os.path.splitext(value.name)[1] - valid_extensions = ['.mp4'] - if not ext.lower() in valid_extensions: - raise ValidationError('Unsupported file extension.') +import os +import logging +error_logger = logging.getLogger('django.error') + +def validate_file_extension_mp4(value): + try: + ext = os.path.splitext(value.name)[1] + valid_extensions = ['.mp4'] + if not ext.lower() in valid_extensions: + error_logger.error(f"Неподдерживаемое расширение файла для файла: {value.name}") + except Exception as e: + error_logger.error(f"Критическая в validate_file_extension_mp4: {str(e)}") + raise def validate_file_extension_webm(value): - import os - from django.core.exceptions import ValidationError - ext = os.path.splitext(value.name)[1] - valid_extensions = ['.webm'] - if not ext.lower() in valid_extensions: - raise ValidationError('Unsupported file extension.') + try: + ext = os.path.splitext(value.name)[1] + valid_extensions = ['.webm'] + if not ext.lower() in valid_extensions: + error_logger.error(f"Неподдерживаемое расширение файла для файла: {value.name}") + except Exception as e: + error_logger.error(f"Критическая в validate_file_extension_webm: {str(e)}") + raise \ No newline at end of file