BO 1.9.2 ckeditor

This commit is contained in:
Bossanyi Tibor 2021-04-24 19:23:01 +02:00
parent a3418cfd91
commit eacefb27b6
8 changed files with 28 additions and 15 deletions

View File

@ -0,0 +1,6 @@
{% extends "admin/base_site.html" %}
{% block extrahead %}
<script>window.CKEDITOR_BASEPATH = '/static/ckeditor/ckeditor/';</script>
{{ block.super }}
{% endblock %}

View File

@ -1,6 +1,6 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from froala_editor.fields import FroalaField
from ckeditor.fields import RichTextField
from .enums import LanguageTypes
from .exercise_device import ExerciseDevice
@ -21,7 +21,7 @@ class ExerciseType(models.Model):
exercise_type_id = models.AutoField(primary_key=True)
name = models.CharField(max_length=100, help_text='The name should be in English here')
#description = models.TextField(max_length=1000, blank=True, null=True, help_text='The description should be in English here')
description = FroalaField()
description = RichTextField()
unit = models.CharField(choices=UnitTypes.choices, default=UnitTypes.REPEAT, max_length=50, blank=True, null=True)
unit_quantity = models.BooleanField(default=0, blank=True, null=True)
unit_quantity_unit = models.CharField(choices=UnitTypes.choices, default=UnitTypes.KG, max_length=50, blank=True,
@ -67,7 +67,7 @@ class ExerciseTypeTranslation(models.Model):
language_code = models.CharField(max_length=2, choices=LanguageTypes.choices, default=LanguageTypes.HU)
name = models.CharField(max_length=100)
#description = models.TextField(max_length=1000, blank=True, null=True)
description = FroalaField(blank=True, null=True)
description = RichTextField(blank=True, null=True)
class Meta:
db_table = 'exercise_type_translation'

View File

@ -1,6 +1,6 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from froala_editor.fields import FroalaField
from ckeditor.fields import RichTextField
from .enums import LanguageTypes
@ -23,8 +23,8 @@ class TutorialSteps(models.Model):
tutorial_step_id = models.AutoField(primary_key=True)
tutorial = models.ForeignKey(Tutorial, on_delete=models.CASCADE)
step = models.IntegerField(help_text="Tutorial Step")
tutorial_text = FroalaField()
error_text = FroalaField(blank=True, null=True)
tutorial_text = RichTextField()
error_text = RichTextField(blank=True, null=True)
check_text = models.TextField(max_length=50, blank=True, null=True, help_text="Only for programmers!")
class Meta:
@ -37,8 +37,8 @@ class TutorialTranslation(models.Model):
translation_id = models.AutoField(primary_key=True)
tutorial_step = models.ForeignKey(TutorialSteps, on_delete=models.CASCADE)
language_code = models.CharField(max_length=2, choices=LanguageTypes.choices, default=LanguageTypes.HU)
tutorial_text = FroalaField()
error_text = FroalaField(blank=True, null=True)
tutorial_text = RichTextField()
error_text = RichTextField(blank=True, null=True)
class Meta:
db_table = 'tutorial_translation'

View File

@ -44,7 +44,8 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'froala_editor'
'ckeditor',
'ckeditor_uploader',
]
MIDDLEWARE = [
@ -129,8 +130,10 @@ STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_JS_DIR = os.path.join(STATIC_URL, "js")
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
CKEDITOR_UPLOAD_PATH = MEDIA_URL
LOGGING = {
'version': 1,

View File

@ -40,7 +40,8 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'froala_editor'
'ckeditor',
'ckeditor_uploader',
]
MIDDLEWARE = [
@ -79,8 +80,8 @@ WSGI_APPLICATION = 'aitrainer_backoffice.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'aitrainer',
'USER': 'aitrainer_test',
'NAME': 'aitrainer_test',
'USER': 'aitrainer',
'PASSWORD': 'andio2009',
'HOST': '62.171.188.119',
'PORT': 33060
@ -126,6 +127,7 @@ STATIC_ROOT = os.path.join(BASE_DIR, "static")
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
CKEDITOR_UPLOAD_PATH = MEDIA_URL
LOGGING = {
'version': 1,

View File

@ -20,13 +20,14 @@ from django.conf import settings #
from django.conf.urls.static import static # n
from django.contrib import admin
from django.urls import path, include
from froala_editor import views
urlpatterns = [
path('admin/', admin.site.urls),
path('froala_editor/',include('froala_editor.urls'))
path(r'^ckeditor/', include('ckeditor_uploader.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
admin.site.site_header = 'WorkoutTest Admin'

View File

@ -0,0 +1 @@
python manage.py collectstatic --settings aitrainer_backoffice.settings.dev

View File

@ -1,5 +1,5 @@
django==3.2
django-froala-editor=3.2.6-1
django-ckeditor==6.0.0
asgiref==3.3.4
certifi==2020.6.20
chardet==3.0.4