mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 01:37:11 +00:00
change markdown editor to martor
This commit is contained in:
@@ -3,6 +3,7 @@ from uuid import uuid4
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Count, Q
|
from django.db.models import Count, Q
|
||||||
from tinymce.models import HTMLField
|
from tinymce.models import HTMLField
|
||||||
|
from martor.models import MartorField
|
||||||
|
|
||||||
from apps.competition.models import Competition
|
from apps.competition.models import Competition
|
||||||
from apps.core.models import BaseModel
|
from apps.core.models import BaseModel
|
||||||
@@ -24,7 +25,7 @@ class CompetitionTask(BaseModel):
|
|||||||
)
|
)
|
||||||
competition = models.ForeignKey(Competition, on_delete=models.CASCADE)
|
competition = models.ForeignKey(Competition, on_delete=models.CASCADE)
|
||||||
title = models.CharField(verbose_name="заголовок", max_length=50)
|
title = models.CharField(verbose_name="заголовок", max_length=50)
|
||||||
description = HTMLField(verbose_name="описание")
|
description = MartorField(verbose_name="описание")
|
||||||
max_attempts = models.PositiveSmallIntegerField(null=True, blank=True)
|
max_attempts = models.PositiveSmallIntegerField(null=True, blank=True)
|
||||||
type = models.CharField(
|
type = models.CharField(
|
||||||
choices=CompetitionTaskType, max_length=8, verbose_name="тип проверки"
|
choices=CompetitionTaskType, max_length=8, verbose_name="тип проверки"
|
||||||
|
|||||||
@@ -442,6 +442,7 @@ INSTALLED_APPS = [
|
|||||||
"ninja",
|
"ninja",
|
||||||
"minio_storage",
|
"minio_storage",
|
||||||
"tinymce",
|
"tinymce",
|
||||||
|
"martor",
|
||||||
# Internal apps
|
# Internal apps
|
||||||
"apps.core",
|
"apps.core",
|
||||||
"apps.user",
|
"apps.user",
|
||||||
@@ -459,15 +460,49 @@ TINYMCE_DEFAULT_CONFIG = {
|
|||||||
"menubar": False,
|
"menubar": False,
|
||||||
"plugins": "advlist,autolink,lists,link,image,charmap,print,preview,anchor,"
|
"plugins": "advlist,autolink,lists,link,image,charmap,print,preview,anchor,"
|
||||||
"searchreplace,visualblocks,code,fullscreen,insertdatetime,media,table,paste,"
|
"searchreplace,visualblocks,code,fullscreen,insertdatetime,media,table,paste,"
|
||||||
"code,help,wordcount",
|
"code,help,wordcount,markdown",
|
||||||
"toolbar": "undo redo | formatselect | "
|
"toolbar": "undo redo | formatselect | "
|
||||||
"bold italic backcolor | alignleft aligncenter "
|
"bold italic backcolor | alignleft aligncenter "
|
||||||
"alignright alignjustify | bullist numlist outdent indent | "
|
"alignright alignjustify | bullist numlist outdent indent | "
|
||||||
"removeformat | help",
|
"removeformat | help",
|
||||||
"skin": "oxide-dark",
|
"skin": "oxide-dark",
|
||||||
"content_css": "dark",
|
"content_css": "dark",
|
||||||
|
"textpattern_patterns": [
|
||||||
|
{"start": "*", "end": "*", "format": "italic"},
|
||||||
|
{"start": "**", "end": "**", "format": "bold"},
|
||||||
|
{"start": "#", "format": "h1"},
|
||||||
|
{"start": "##", "format": "h2"},
|
||||||
|
{"start": "###", "format": "h3"},
|
||||||
|
{"start": "####", "format": "h4"},
|
||||||
|
{"start": "#####", "format": "h5"},
|
||||||
|
{"start": "######", "format": "h6"},
|
||||||
|
{"start": "1. ", "cmd": "InsertOrderedList"},
|
||||||
|
{"start": "* ", "cmd": "InsertUnorderedList"},
|
||||||
|
{"start": "- ", "cmd": "InsertUnorderedList"}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# martor
|
||||||
|
|
||||||
|
MARTOR_THEME = 'bootstrap'
|
||||||
|
|
||||||
|
MARTOR_ENABLE_CONFIGS = {
|
||||||
|
'emoji': 'true', # to enable/disable emoji icons.
|
||||||
|
'imgur': 'true', # to enable/disable imgur/custom uploader.
|
||||||
|
'mention': 'false', # to enable/disable mention
|
||||||
|
'jquery': 'true', # to include/revoke jquery (require for admin default django)
|
||||||
|
'living': 'false', # to enable/disable live updates in preview
|
||||||
|
'spellcheck': 'false', # to enable/disable spellcheck in form textareas
|
||||||
|
'hljs': 'true', # to enable/disable hljs highlighting in preview
|
||||||
|
}
|
||||||
|
|
||||||
|
MARTOR_TOOLBAR_BUTTONS = [
|
||||||
|
'bold', 'italic', 'horizontal', 'heading', 'pre-code',
|
||||||
|
'blockquote', 'unordered-list', 'ordered-list',
|
||||||
|
'link', 'emoji',
|
||||||
|
'direct-mention', 'toggle-maximize', 'help'
|
||||||
|
]
|
||||||
|
|
||||||
# GUID
|
# GUID
|
||||||
|
|
||||||
DJANGO_GUID = {
|
DJANGO_GUID = {
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ admin.site.index_title = "DataRush"
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# tinymce
|
# tinymce
|
||||||
path("tinymce/", include("tinymce.urls")),
|
path("tinymce/", include("tinymce.urls")),
|
||||||
|
# martor
|
||||||
|
path('martor/', include('martor.urls')),
|
||||||
# Admin urls
|
# Admin urls
|
||||||
path("admin/", admin.site.urls),
|
path("admin/", admin.site.urls),
|
||||||
# API urls
|
# API urls
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ dependencies = [
|
|||||||
"django-tinymce>=4.1.0",
|
"django-tinymce>=4.1.0",
|
||||||
"gunicorn>=23.0.0",
|
"gunicorn>=23.0.0",
|
||||||
"httpx>=0.28.1",
|
"httpx>=0.28.1",
|
||||||
|
"martor>=1.6.45",
|
||||||
"pillow>=11.1.0",
|
"pillow>=11.1.0",
|
||||||
"psycopg2-binary>=2.9.10",
|
"psycopg2-binary>=2.9.10",
|
||||||
"pydantic>=2.10.5",
|
"pydantic>=2.10.5",
|
||||||
|
|||||||
Reference in New Issue
Block a user