add tinymce

This commit is contained in:
Timur
2025-03-01 17:23:12 +03:00
parent 332ca694a8
commit c0d4c56736
5 changed files with 30 additions and 8 deletions
+8 -7
View File
@@ -1,6 +1,7 @@
from datetime import datetime from datetime import datetime
from django.db import models from django.db import models
from tinymce.models import HTMLField
from apps.core.models import BaseModel from apps.core.models import BaseModel
from apps.user.models import User from apps.user.models import User
@@ -14,26 +15,26 @@ class Competition(BaseModel):
EDU = "edu", "Образовательный" EDU = "edu", "Образовательный"
COMPETITIVE = "competitive", "Соревновательный" COMPETITIVE = "competitive", "Соревновательный"
title = models.CharField(max_length=100, verbose_name="Название") title = models.CharField(max_length=100, verbose_name="аазвание")
description = models.TextField(verbose_name="Описание") description = HTMLField(verbose_name="описание")
image_url = models.FileField( image_url = models.FileField(
verbose_name="Изображение соревнования", null=True, blank=True verbose_name="изображение соревнования", null=True, blank=True
) )
end_date = models.DateTimeField( end_date = models.DateTimeField(
verbose_name="Дедлайн участия", null=True, blank=True verbose_name="дедлайн участия", null=True, blank=True
) )
start_date = models.DateTimeField( start_date = models.DateTimeField(
verbose_name="Дедлайн участия", null=True, blank=True verbose_name="дедлайн участия", null=True, blank=True
) )
type = models.CharField( type = models.CharField(
max_length=10, max_length=10,
choices=CompetitionType.choices, choices=CompetitionType.choices,
verbose_name="Тип участия", verbose_name="тип участия",
) )
participation_type = models.CharField( participation_type = models.CharField(
max_length=11, max_length=11,
choices=CompetitionParticipationType.choices, choices=CompetitionParticipationType.choices,
verbose_name="Тип соревнования", verbose_name="тип соревнования",
) )
participants = models.ManyToManyField(User, related_name="participants", blank=True, participants = models.ManyToManyField(User, related_name="participants", blank=True,
editable=False) editable=False)
+2 -1
View File
@@ -1,6 +1,7 @@
from uuid import uuid4 from uuid import uuid4
from django.db import models from django.db import models
from tinymce.models import HTMLField
from apps.competition.models import Competition from apps.competition.models import Competition
from apps.core.models import BaseModel from apps.core.models import BaseModel
@@ -19,7 +20,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 = models.TextField(verbose_name="описание", max_length=300) description = HTMLField(verbose_name="описание", max_length=300)
max_attemps = models.PositiveSmallIntegerField() max_attemps = models.PositiveSmallIntegerField()
type = models.CharField( type = models.CharField(
choices=CompetitionTaskType, max_length=8, verbose_name="тип проверки" choices=CompetitionTaskType, max_length=8, verbose_name="тип проверки"
+17
View File
@@ -441,6 +441,7 @@ INSTALLED_APPS = [
"django_guid", "django_guid",
"ninja", "ninja",
"minio_storage", "minio_storage",
"tinymce",
# Internal apps # Internal apps
"apps.core", "apps.core",
"apps.user", "apps.user",
@@ -449,6 +450,22 @@ INSTALLED_APPS = [
"apps.task", "apps.task",
] ]
# tinymce
TINYMCE_DEFAULT_CONFIG = {
"theme": "silver",
"height": 500,
"menubar": False,
"plugins": "advlist,autolink,lists,link,image,charmap,print,preview,anchor,"
"searchreplace,visualblocks,code,fullscreen,insertdatetime,media,table,paste,"
"code,help,wordcount",
"toolbar": "undo redo | formatselect | "
"bold italic backcolor | alignleft aligncenter "
"alignright alignjustify | bullist numlist outdent indent | "
"removeformat | help",
"skin": "oxide-dark",
"content_css": "dark"
}
# GUID # GUID
DJANGO_GUID = { DJANGO_GUID = {
+2
View File
@@ -12,6 +12,8 @@ admin.site.index_title = "DataRush"
urlpatterns = [ urlpatterns = [
# tinymce
path('tinymce/', include('tinymce.urls')),
# Admin urls # Admin urls
path("admin/", admin.site.urls), path("admin/", admin.site.urls),
# API urls # API urls
+1
View File
@@ -13,6 +13,7 @@ dependencies = [
"django-health-check>=3.18.3", "django-health-check>=3.18.3",
"django-minio-storage>=0.5.7", "django-minio-storage>=0.5.7",
"django-ninja>=1.3.0", "django-ninja>=1.3.0",
"django-pagedown>=2.2.1",
"django-stubs-ext>=5.1.3", "django-stubs-ext>=5.1.3",
"gunicorn>=23.0.0", "gunicorn>=23.0.0",
"httpx>=0.28.1", "httpx>=0.28.1",