TinyMCE editor and code cleanup.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from django.contrib import admin
|
||||
from app.models import Setting, File
|
||||
from .models import Setting, File
|
||||
from django.conf import settings
|
||||
|
||||
# Register your models here.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from django.db import models
|
||||
from tinymce.models import HTMLField
|
||||
|
||||
# Create your models here.
|
||||
|
||||
@@ -8,7 +9,7 @@ class Setting(models.Model):
|
||||
return 'Setting {0} - {1} ({2})'.format(self.name, self.language, self.id)
|
||||
name = models.CharField(max_length=100)
|
||||
language = models.CharField(max_length=5)
|
||||
string = models.TextField()
|
||||
string = HTMLField()
|
||||
|
||||
|
||||
class File(models.Model):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from app.models import Setting
|
||||
from .models import Setting
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from django.shortcuts import render, get_object_or_404, redirect
|
||||
from django.utils.translation import gettext as _
|
||||
from django.conf import settings
|
||||
from app.settings_db import get_setting
|
||||
from .settings_db import get_setting
|
||||
from django.utils import translation
|
||||
from app.models import File
|
||||
from .models import File
|
||||
from django.http import HttpResponseBadRequest
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'tinymce',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
@@ -136,6 +137,16 @@ MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
||||
APP_NAME = 'NoNiko'
|
||||
|
||||
|
||||
# TinyMCE Options
|
||||
TINYMCE_DEFAULT_CONFIG = {
|
||||
'plugins': "table,spellchecker,paste,searchreplace",
|
||||
'theme': "advanced",
|
||||
'cleanup_on_startup': True,
|
||||
'custom_undo_redo_levels': 10,
|
||||
}
|
||||
TINYMCE_SPELLCHECKER = True
|
||||
|
||||
|
||||
# Try to load local setting file
|
||||
try:
|
||||
from local_settings import *
|
||||
|
||||
@@ -14,7 +14,7 @@ Including another URLconf
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.urls import path, include
|
||||
import app.views
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
@@ -22,5 +22,6 @@ from django.conf.urls.static import static
|
||||
urlpatterns = [
|
||||
path('', app.views.home, name='home'),
|
||||
path('get_file', app.views.get_file, name='get_file'),
|
||||
path('tinymce/', include('tinymce.urls')),
|
||||
path('admin/', admin.site.urls),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # Warning! This is not suitable for production.
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
django >=2, <3
|
||||
django-tinymce
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<html lang="{{ LANGUAGE_CODE }}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="theme-color" content="#00FF00">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="{{ description }}" />
|
||||
<meta name="keywords" content="{{ keywords }}" />
|
||||
@@ -15,15 +16,15 @@
|
||||
<table>
|
||||
<tr>
|
||||
<th><a href="{% url "home" %}">{{ app_name }}</a></th>
|
||||
<td><a href="{% url "home" %}">Home</a></td>
|
||||
<td><a href="#">Downloads</a></td>
|
||||
<td><a href="#">About</a></td>
|
||||
<td><a href="{% url "home" %}">{% trans "Home" %}</a></td>
|
||||
<td><a href="#">{% trans "Downloads" %}</a></td>
|
||||
<td><a href="#">{% trans "About" %}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
{% block body %}
|
||||
{% endblock %}
|
||||
<hr/>
|
||||
<p align="center">Copyright {{ app_name }} developers - {% now "Y" %}</p>
|
||||
<p align="center">{% blocktrans %}Copyright {{ app_name }} developers {% endblocktrans %} - {% now "Y" %}</p>
|
||||
</body>
|
||||
{% block scripts %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user