CKEditor Migration Successfully Completed
This commit is contained in:
parent
78fadaa1da
commit
b860590127
11 changed files with 148 additions and 56 deletions
|
@ -6,11 +6,13 @@
|
|||
|
||||
|
||||
SITE_ID = 1
|
||||
ACCOUNT_AUTHENTICATION_METHOD = "username_email"
|
||||
ACCOUNT_EMAIL_REQUIRED = True
|
||||
# Updated settings to replace deprecated options
|
||||
ACCOUNT_LOGIN_METHODS = {"username", "email"} # Replaces ACCOUNT_AUTHENTICATION_METHOD
|
||||
ACCOUNT_SIGNUP_FIELDS = ["email*", "username*", "password1*", "password2*"] # Replaces ACCOUNT_EMAIL_REQUIRED
|
||||
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
||||
ACCOUNT_LOGIN_ATTEMPTS_LIMIT = 5
|
||||
ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT = 900 # 15 Minutes
|
||||
ACCOUNT_RATE_LIMITS = {
|
||||
"login_failed": "5/15m", # Replaces ACCOUNT_LOGIN_ATTEMPTS_LIMIT/TIMEOUT (5 attempts per 15 minutes)
|
||||
}
|
||||
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True
|
||||
ACCOUNT_LOGOUT_REDIRECT_URL = "/"
|
||||
ACCOUNT_LOGOUT_ON_GET = True
|
||||
|
|
|
@ -1,15 +1,90 @@
|
|||
# -----------------------------------
|
||||
# CKEDITOR CONFIGURATION
|
||||
# CKEDITOR 5 CONFIGURATION
|
||||
# -----------------------------------
|
||||
|
||||
CKEDITOR_BASEPATH = "/static/ckeditor/ckeditor/"
|
||||
CKEDITOR_UPLOAD_PATH = "media"
|
||||
customColorPalette = [
|
||||
{
|
||||
'color': 'hsl(4, 90%, 58%)',
|
||||
'label': 'Red'
|
||||
},
|
||||
{
|
||||
'color': 'hsl(340, 82%, 52%)',
|
||||
'label': 'Pink'
|
||||
},
|
||||
{
|
||||
'color': 'hsl(291, 64%, 42%)',
|
||||
'label': 'Purple'
|
||||
},
|
||||
{
|
||||
'color': 'hsl(262, 52%, 47%)',
|
||||
'label': 'Deep Purple'
|
||||
},
|
||||
{
|
||||
'color': 'hsl(231, 48%, 48%)',
|
||||
'label': 'Indigo'
|
||||
},
|
||||
{
|
||||
'color': 'hsl(207, 90%, 54%)',
|
||||
'label': 'Blue'
|
||||
},
|
||||
]
|
||||
|
||||
CKEDITOR_CONFIGS = {
|
||||
"default": {
|
||||
"removePlugins": "exportpdf",
|
||||
"height": 300,
|
||||
"width": "100%",
|
||||
"allowedContent": True,
|
||||
CKEDITOR_5_CONFIGS = {
|
||||
'default': {
|
||||
'toolbar': ['heading', '|', 'bold', 'italic', 'link',
|
||||
'bulletedList', 'numberedList', 'blockQuote', 'imageUpload', ],
|
||||
|
||||
},
|
||||
'extends': {
|
||||
'blockToolbar': [
|
||||
'paragraph', 'heading1', 'heading2', 'heading3',
|
||||
'|',
|
||||
'bulletedList', 'numberedList',
|
||||
'|',
|
||||
'blockQuote',
|
||||
],
|
||||
'toolbar': ['heading', '|', 'outdent', 'indent', '|', 'bold', 'italic', 'link', 'underline', 'strikethrough',
|
||||
'code','subscript', 'superscript', 'highlight', '|', 'codeBlock', 'sourceEditing', 'insertImage',
|
||||
'bulletedList', 'numberedList', 'todoList', '|', 'blockQuote', 'imageUpload', '|',
|
||||
'fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor', 'mediaEmbed', 'removeFormat',
|
||||
'insertTable',],
|
||||
'image': {
|
||||
'toolbar': ['imageTextAlternative', '|', 'imageStyle:alignLeft',
|
||||
'imageStyle:alignRight', 'imageStyle:alignCenter', 'imageStyle:side', ],
|
||||
'styles': [
|
||||
'full',
|
||||
'side',
|
||||
'alignLeft',
|
||||
'alignRight',
|
||||
'alignCenter',
|
||||
]
|
||||
},
|
||||
'table': {
|
||||
'contentToolbar': [ 'tableColumn', 'tableRow', 'mergeTableCells',
|
||||
'tableProperties', 'tableCellProperties' ],
|
||||
'tableProperties': {
|
||||
'borderColors': customColorPalette,
|
||||
'backgroundColors': customColorPalette
|
||||
},
|
||||
'tableCellProperties': {
|
||||
'borderColors': customColorPalette,
|
||||
'backgroundColors': customColorPalette
|
||||
}
|
||||
},
|
||||
'heading' : {
|
||||
'options': [
|
||||
{ 'model': 'paragraph', 'title': 'Paragraph', 'class': 'ck-heading_paragraph' },
|
||||
{ 'model': 'heading1', 'view': 'h1', 'title': 'Heading 1', 'class': 'ck-heading_heading1' },
|
||||
{ 'model': 'heading2', 'view': 'h2', 'title': 'Heading 2', 'class': 'ck-heading_heading2' },
|
||||
{ 'model': 'heading3', 'view': 'h3', 'title': 'Heading 3', 'class': 'ck-heading_heading3' }
|
||||
]
|
||||
}
|
||||
},
|
||||
'list': {
|
||||
'properties': {
|
||||
'styles': 'true',
|
||||
'startIndex': 'true',
|
||||
'reversed': 'true',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
CSP_DEFAULT_SRC = (
|
||||
"'self'",
|
||||
"https://cdn.datatables.net",
|
||||
"https://cke4.ckeditor.com",
|
||||
"https://cdn.ckeditor.com",
|
||||
)
|
||||
CSP_STYLE_SRC = (
|
||||
"'self'",
|
||||
|
|
|
@ -74,10 +74,9 @@ INSTALLED_APPS = [
|
|||
"crispy_bootstrap5",
|
||||
"crispy_forms",
|
||||
# -----------------------------------
|
||||
# CKEditor
|
||||
# CKEditor 5
|
||||
# -----------------------------------
|
||||
"ckeditor",
|
||||
"ckeditor_uploader",
|
||||
"django_ckeditor_5",
|
||||
# -----------------------------------
|
||||
# My Apps
|
||||
# -----------------------------------
|
||||
|
@ -209,11 +208,10 @@ CRISPY_TEMPLATE_PACK = "bootstrap5"
|
|||
# -----------------------------------
|
||||
try:
|
||||
from .allauth import (
|
||||
ACCOUNT_AUTHENTICATION_METHOD,
|
||||
ACCOUNT_EMAIL_REQUIRED,
|
||||
ACCOUNT_LOGIN_METHODS,
|
||||
ACCOUNT_SIGNUP_FIELDS,
|
||||
ACCOUNT_EMAIL_VERIFICATION,
|
||||
ACCOUNT_LOGIN_ATTEMPTS_LIMIT,
|
||||
ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT,
|
||||
ACCOUNT_RATE_LIMITS,
|
||||
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION,
|
||||
ACCOUNT_LOGOUT_REDIRECT_URL,
|
||||
ACCOUNT_LOGOUT_ON_GET,
|
||||
|
@ -262,8 +260,8 @@ try:
|
|||
except ImportError:
|
||||
print("No Jazzmin Settings found!")
|
||||
|
||||
# CKEditor
|
||||
# CKEditor 5
|
||||
try:
|
||||
from .ckeditor import CKEDITOR_CONFIGS, CKEDITOR_BASEPATH, CKEDITOR_UPLOAD_PATH
|
||||
from .ckeditor import CKEDITOR_5_CONFIGS
|
||||
except ImportError:
|
||||
print("No CKEditor Settings found!")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue