From baaab0cb0968354f8ae3c05385d81d8b33f3d803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20G=C3=BCtzkow?= <70779496+CJGutz@users.noreply.github.com> Date: Sat, 16 Mar 2024 18:15:32 +0100 Subject: [PATCH 1/3] remove ckeditor --- .../migrations/0030_alter_item_description.py | 19 +++++ inventory/models/item.py | 29 ++++--- inventory/templates/inventory/edit_item.html | 7 +- .../templates/inventory/item_detail.html | 2 +- news/templates/news/edit_article.html | 9 +-- news/templates/news/edit_event.html | 9 +-- requirements.txt | 1 - .../0045_alter_termsofservice_text.py | 19 +++++ userprofile/models.py | 10 ++- .../templates/userprofile/create_tos.html | 4 +- .../templates/userprofile/tos_detail.html | 2 +- website/migrations/0024_alter_rule_body.py | 19 +++++ website/models.py | 10 ++- website/settings.py | 75 ------------------- .../templates/website/inputs/markdown.html | 13 ++++ website/templates/website/rule_details.html | 4 +- 16 files changed, 117 insertions(+), 115 deletions(-) create mode 100644 inventory/migrations/0030_alter_item_description.py create mode 100644 userprofile/migrations/0045_alter_termsofservice_text.py create mode 100644 website/migrations/0024_alter_rule_body.py create mode 100644 website/templates/website/inputs/markdown.html diff --git a/inventory/migrations/0030_alter_item_description.py b/inventory/migrations/0030_alter_item_description.py new file mode 100644 index 000000000..741aa5a51 --- /dev/null +++ b/inventory/migrations/0030_alter_item_description.py @@ -0,0 +1,19 @@ +# Generated by Django 5.0.3 on 2024-03-16 17:47 + +import markdownx.models +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('inventory', '0029_equipment'), + ] + + operations = [ + migrations.AlterField( + model_name='item', + name='description', + field=markdownx.models.MarkdownxField(blank=True, verbose_name='Beskrivelse'), + ), + ] diff --git a/inventory/models/item.py b/inventory/models/item.py index 0b406ec50..3dfc0bab3 100644 --- a/inventory/models/item.py +++ b/inventory/models/item.py @@ -1,6 +1,10 @@ -from ckeditor_uploader.fields import RichTextUploadingField +from bleach import clean +from bleach_whitelist import markdown_attrs, markdown_tags from django.core.validators import MinValueValidator from django.db import models +from django.utils.translation import gettext_lazy as _ +from markdownx.models import MarkdownxField +from markdownx.utils import markdownify from files.models import Image from inventory.models.item_loan import ItemLoan @@ -9,22 +13,24 @@ class Item(models.Model): """Represents a single item in inventory""" - name = models.CharField("Navn", max_length=50) - stock = models.IntegerField("Lagerbeholdning", validators=[MinValueValidator(0)]) + name = models.CharField(_("Navn"), max_length=50) + stock = models.IntegerField(_("Lagerbeholdning"), validators=[MinValueValidator(0)]) unknown_stock = models.BooleanField( - "Ukjent lagerbeholdning", null=False, blank=False, default=False + _("Ukjent lagerbeholdning"), null=False, blank=False, default=False ) - can_loan = models.BooleanField("Kan lånes", null=False, blank=False, default=True) - description = RichTextUploadingField("Beskrivelse", blank=True) + can_loan = models.BooleanField( + _("Kan lånes"), null=False, blank=False, default=True + ) + description = MarkdownxField(_("Beskrivelse"), blank=True) thumbnail = models.ForeignKey( - Image, on_delete=models.SET_NULL, null=True, blank=True, verbose_name="Bilde" + Image, on_delete=models.SET_NULL, null=True, blank=True, verbose_name=_("Bilde") ) - location = models.CharField("Hylleplass", max_length=50, blank=True) + location = models.CharField(_("Hylleplass"), max_length=50, blank=True) max_loan_duration = models.PositiveIntegerField( - "Maks lånevarighet (dager)", blank=True, null=True + _("Maks lånevarighet (dager)"), blank=True, null=True ) - views = models.IntegerField("Detaljsidevisninger", default=0, editable=True) + views = models.IntegerField(_("Detaljsidevisninger"), default=0, editable=True) def __str__(self): return self.name + " (x" + str(self.stock) + ")" @@ -82,3 +88,6 @@ def popularity(self): def save(self, *args, **kwargs): self.location = self.location.lower() return super(Item, self).save(*args, **kwargs) + + def body_formatted_markdown(self): + return clean(markdownify(self.description), markdown_tags, markdown_attrs) diff --git a/inventory/templates/inventory/edit_item.html b/inventory/templates/inventory/edit_item.html index 16647e6bd..719b1a5ee 100644 --- a/inventory/templates/inventory/edit_item.html +++ b/inventory/templates/inventory/edit_item.html @@ -63,10 +63,9 @@ -
-

{{ form.description.label }}

- {{ form.description.errors }} - {{ form.description }} + +
+ {% include "website/inputs/markdown.html" with form=form form_field=form.description %}
diff --git a/inventory/templates/inventory/item_detail.html b/inventory/templates/inventory/item_detail.html index cb07c35a7..f0e005639 100644 --- a/inventory/templates/inventory/item_detail.html +++ b/inventory/templates/inventory/item_detail.html @@ -46,7 +46,7 @@
{% if item.description %}
{% autoescape off %} - {{ item.description }} + {{ item.body_formatted_markdown | safe }} {% endautoescape %} {% endif %} diff --git a/news/templates/news/edit_article.html b/news/templates/news/edit_article.html index 2c64abaf5..bc84dcc1d 100644 --- a/news/templates/news/edit_article.html +++ b/news/templates/news/edit_article.html @@ -35,15 +35,8 @@
{% trans "Innhold" %}
-

{{ form.main_content.label }}

- {{ form.main_content.errors }} - {{ form.main_content }} -
-

{% trans "Bare markdown støttes i dette feltet, html blir returnert som plaintext. Bilder kan legges til ved drag-and-drop." %}

-

Markdown cheat-sheet

-
+ {% include "website/inputs/markdown.html" with form=form form_field=form.main_content%}
- {{ form.media }}
diff --git a/news/templates/news/edit_event.html b/news/templates/news/edit_event.html index 535dc2eac..791396ce7 100644 --- a/news/templates/news/edit_event.html +++ b/news/templates/news/edit_event.html @@ -40,15 +40,8 @@
{% trans "Innhold" %}
{{ form.ingress_content.errors }}
-

{{ form.main_content.label }}

- {{ form.main_content.errors }} - {{ form.main_content }} -
-

{% trans "Bare markdown støttes i dette feltet, html blir returnert som plaintext. Bilder kan legges til ved drag-and-drop." %}

-

Markdown cheat-sheet

-
+ {% include "website/inputs/markdown.html" with form=form form_field=form.main_content%}
- {{ form.media }}
diff --git a/requirements.txt b/requirements.txt index d5b52c655..99463201e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ pre-commit==2.15.0 Django==3.2.24 -django-ckeditor==6.2.0 coverage==6.3.2 sorl-thumbnail==12.8.0 python-coveralls==2.9.3 diff --git a/userprofile/migrations/0045_alter_termsofservice_text.py b/userprofile/migrations/0045_alter_termsofservice_text.py new file mode 100644 index 000000000..0b26ff01b --- /dev/null +++ b/userprofile/migrations/0045_alter_termsofservice_text.py @@ -0,0 +1,19 @@ +# Generated by Django 5.0.3 on 2024-03-16 17:47 + +import markdownx.models +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('userprofile', '0044_alter_profile_phone_number'), + ] + + operations = [ + migrations.AlterField( + model_name='termsofservice', + name='text', + field=markdownx.models.MarkdownxField(), + ), + ] diff --git a/userprofile/models.py b/userprofile/models.py index 00214d9d4..0cab3c429 100644 --- a/userprofile/models.py +++ b/userprofile/models.py @@ -1,12 +1,15 @@ from typing import Iterable, List -from ckeditor.fields import RichTextField +from bleach import clean +from bleach_whitelist import markdown_attrs, markdown_tags from django.contrib.auth.admin import User from django.core.files.base import ContentFile from django.db import models from django.db.models import Q from django.shortcuts import reverse from django.utils import timezone +from markdownx.models import MarkdownxField +from markdownx.utils import markdownify from sorl.thumbnail import get_thumbnail from applications.validators import validate_phone_number @@ -15,12 +18,15 @@ class TermsOfService(models.Model): - text = RichTextField(config_name="tos_editor") + text = MarkdownxField() pub_date = models.DateField(default=timezone.now, verbose_name="Publiseringsdato") def __str__(self): return self.pub_date.strftime("%d. %B %Y") + def body_formatted_markdown(self): + return clean(markdownify(self.text), markdown_tags, markdown_attrs) + class Skill(models.Model): diff --git a/userprofile/templates/userprofile/create_tos.html b/userprofile/templates/userprofile/create_tos.html index ea84ffcc1..284524ad6 100644 --- a/userprofile/templates/userprofile/create_tos.html +++ b/userprofile/templates/userprofile/create_tos.html @@ -29,9 +29,9 @@
Innhold

{% csrf_token %} +
-

{{ form.text.label }}

- {{ form.text }} + {% include "website/inputs/markdown.html" with form=form form_field=form.text%}
date_range diff --git a/userprofile/templates/userprofile/tos_detail.html b/userprofile/templates/userprofile/tos_detail.html index 95abe5150..207a9fd9b 100644 --- a/userprofile/templates/userprofile/tos_detail.html +++ b/userprofile/templates/userprofile/tos_detail.html @@ -18,7 +18,7 @@

Vilkår for bruk av nettside

{% autoescape off %} - {{ termsofservice.text }} + {{ termsofservice.body_formatted_markdown | safe }} {% endautoescape %}
diff --git a/website/migrations/0024_alter_rule_body.py b/website/migrations/0024_alter_rule_body.py new file mode 100644 index 000000000..58b751031 --- /dev/null +++ b/website/migrations/0024_alter_rule_body.py @@ -0,0 +1,19 @@ +# Generated by Django 5.0.3 on 2024-03-16 17:47 + +import markdownx.models +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('website', '0023_rule_norwegian'), + ] + + operations = [ + migrations.AlterField( + model_name='rule', + name='body', + field=markdownx.models.MarkdownxField(), + ), + ] diff --git a/website/models.py b/website/models.py index 5fb7c7a3e..9d01bbb45 100644 --- a/website/models.py +++ b/website/models.py @@ -1,9 +1,12 @@ from datetime import datetime -from ckeditor.fields import RichTextField +from bleach import clean +from bleach_whitelist import markdown_attrs, markdown_tags from django.contrib.auth.models import User from django.db import models from django.db.models import Q +from markdownx.models import MarkdownxField +from markdownx.utils import markdownify from files.models import Image @@ -57,7 +60,7 @@ def search(self, query: str = None): class Rule(models.Model): title = models.CharField(max_length=100, verbose_name="Tittel", blank=False) - body = RichTextField() + body = MarkdownxField() thumb = models.ForeignKey( "files.Image", blank=True, @@ -78,6 +81,9 @@ class Rule(models.Model): def __str__(self): return self.title + def body_formatted_markdown(self): + return clean(markdownify(self.body), markdown_tags, markdown_attrs) + class Meta: permissions = (("can_view_internal_rule", "Can view internal rule"),) diff --git a/website/settings.py b/website/settings.py index 883ecd8cb..2db55b560 100644 --- a/website/settings.py +++ b/website/settings.py @@ -53,8 +53,6 @@ "news", "door", "files", - "ckeditor", - "ckeditor_uploader", "authentication", "userprofile", "seasonal_events", @@ -200,79 +198,6 @@ STATIC_ROOT = "../static" MEDIA_ROOT = "../media" -CKEDITOR_UPLOAD_PATH = "ck_uploads" -CKEDITOR_BASEPATH = "/static/ckeditor/ckeditor/" -CKEDITOR_BROWSE_SHOW_DIRS = True -CKEDITOR_UPLOAD_SLUGIFY_FILENAME = False -CKEDITOR_RESTRICT_BY_USER = False -CKEDITOR_BROWSE_SHOW_DIRS = False - -CKEDITOR_CONFIGS = { - "default": { - "width": "100%", - "toolbar": "Custom", - "toolbar_Custom": [ - ["Bold", "Italic", "-", "Undo", "Redo", "-", "PasteText"], - [ - "NumberedList", - "BulletedList", - "-", - "Link", - "-", - "Outdent", - "Indent", - "-", - "Blockquote", - ], - ["Maximize", "Find", "Replace"], - [ - "Image", - "Table", - "HorizontalRule", - "Smiley", - "SpecialChar", - "PageBreak", - "Iframe", - ], - ], - "extraPlugins": "blockquote", - }, - "tos_editor": { - "width": "100%", - "toolbar": "Custom", - "toolbar_Custom": [ - ["Bold", "Italic", "-", "Undo", "Redo", "-", "PasteText"], - [ - "NumberedList", - "BulletedList", - "-", - "Link", - "-", - "Outdent", - "Indent", - "-", - "Blockquote", - ], - ["Maximize", "Find", "Replace"], - [ - "Image", - "Table", - "HorizontalRule", - "Smiley", - "SpecialChar", - "PageBreak", - "Iframe", - "-", - "Source", - ], - ], - "fullPage": True, - "extraPlugins": "blockquote", - "allowedContent": "h1 h2 h3 h4 p b i strong ul li div (*); a [*](*)", - }, -} - -DEFAULT_CONFIG = CKEDITOR_CONFIGS STATICFILES_FINDERS = ( "django.contrib.staticfiles.finders.FileSystemFinder", diff --git a/website/templates/website/inputs/markdown.html b/website/templates/website/inputs/markdown.html new file mode 100644 index 000000000..980bcb127 --- /dev/null +++ b/website/templates/website/inputs/markdown.html @@ -0,0 +1,13 @@ +{% load i18n %} +{% load static %} + +
+

{{ form_field.label }}

+ {{ form_field.errors }} + {{ form_field }} +
+

{% trans "Bare markdown støttes i dette feltet, html blir returnert som plaintext. Bilder kan legges til ved drag-and-drop." %}

+

Markdown cheat-sheet

+
+ {{ form.media }} +
diff --git a/website/templates/website/rule_details.html b/website/templates/website/rule_details.html index d2908f16a..dd2c24679 100644 --- a/website/templates/website/rule_details.html +++ b/website/templates/website/rule_details.html @@ -40,7 +40,9 @@
{{ rule.title }}
- {{ rule.body | safe }} + {% autoescape off %} + {{ rule.body_formatted_markdown | safe }} + {% endautoescape %}
From 293e4e0e2a722b9b10aa3215267564d3ce140da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20G=C3=BCtzkow?= <70779496+CJGutz@users.noreply.github.com> Date: Sat, 16 Mar 2024 18:34:21 +0100 Subject: [PATCH 2/3] remove ckeditor references from migrations --- inventory/migrations/0006_auto_20201021_0135.py | 5 ++--- inventory/migrations/0007_auto_20201021_0154.py | 3 +-- inventory/templates/inventory/edit_item.html | 2 -- .../inventory/equipment/equipment_edit.html | 4 +--- news/migrations/0001_initial.py | 9 ++++----- news/migrations/0028_auto_20210210_2032.py | 5 ++--- news/templates/news/article.html | 15 --------------- news/templates/news/edit_article.html | 2 -- news/templates/news/edit_event.html | 2 -- news/templates/news/event.html | 15 --------------- projectarchive/migrations/0001_initial.py | 3 +-- .../templates/projectarchive/article.html | 15 --------------- .../templates/projectarchive/edit_article.html | 2 -- userprofile/migrations/0026_auto_20200211_1917.py | 3 +-- userprofile/migrations/0027_auto_20200211_1945.py | 5 ++--- userprofile/migrations/0029_auto_20200304_2007.py | 3 +-- userprofile/templates/userprofile/create_tos.html | 2 -- website/migrations/0014_auto_20210412_1918.py | 5 ++--- website/migrations/0015_auto_20210412_1921.py | 5 ++--- website/migrations/0016_auto_20210412_1944.py | 5 ++--- website/static/website/css/style.css | 4 ---- website/urls.py | 13 ------------- 22 files changed, 21 insertions(+), 106 deletions(-) diff --git a/inventory/migrations/0006_auto_20201021_0135.py b/inventory/migrations/0006_auto_20201021_0135.py index d4489ada6..37b6cda98 100644 --- a/inventory/migrations/0006_auto_20201021_0135.py +++ b/inventory/migrations/0006_auto_20201021_0135.py @@ -1,7 +1,6 @@ # Generated by Django 3.1.2 on 2020-10-21 01:35 -import ckeditor_uploader.fields -from django.db import migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -14,6 +13,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='item', name='description', - field=ckeditor_uploader.fields.RichTextUploadingField(verbose_name='Beskrivelse'), + field=models.TextField(verbose_name='Beskrivelse'), ), ] diff --git a/inventory/migrations/0007_auto_20201021_0154.py b/inventory/migrations/0007_auto_20201021_0154.py index 57c4f756c..d8d1dc3ee 100644 --- a/inventory/migrations/0007_auto_20201021_0154.py +++ b/inventory/migrations/0007_auto_20201021_0154.py @@ -1,6 +1,5 @@ # Generated by Django 3.1.2 on 2020-10-21 01:54 -import ckeditor_uploader.fields from django.db import migrations, models @@ -19,7 +18,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='item', name='description', - field=ckeditor_uploader.fields.RichTextUploadingField(blank=True, verbose_name='Beskrivelse'), + field=models.TextField(blank=True, verbose_name='Beskrivelse'), ), migrations.AlterField( model_name='item', diff --git a/inventory/templates/inventory/edit_item.html b/inventory/templates/inventory/edit_item.html index 719b1a5ee..cdf83b666 100644 --- a/inventory/templates/inventory/edit_item.html +++ b/inventory/templates/inventory/edit_item.html @@ -4,8 +4,6 @@ {% block head %} {{ jquery | safe }} - - {% endblock head %} diff --git a/inventory/templates/inventory/equipment/equipment_edit.html b/inventory/templates/inventory/equipment/equipment_edit.html index 631c39b83..9c88d7c7a 100644 --- a/inventory/templates/inventory/equipment/equipment_edit.html +++ b/inventory/templates/inventory/equipment/equipment_edit.html @@ -2,8 +2,6 @@ {% load static %} {% block head %} - - {% endblock head %} @@ -62,4 +60,4 @@
Innhold
-{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/news/migrations/0001_initial.py b/news/migrations/0001_initial.py index 4b02afd76..b8d13d1a0 100644 --- a/news/migrations/0001_initial.py +++ b/news/migrations/0001_initial.py @@ -2,7 +2,6 @@ # Generated by Django 1.9.2 on 2017-05-04 23:34 from __future__ import unicode_literals -import ckeditor_uploader.fields from django.conf import settings from django.db import migrations, models import django.db.models.deletion @@ -24,8 +23,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=100, verbose_name='Title')), - ('main_content', ckeditor_uploader.fields.RichTextUploadingField(blank=True)), - ('ingress_content', ckeditor_uploader.fields.RichTextUploadingField(blank=True)), + ('main_content', models.TextField(blank=True)), + ('ingress_content', models.TextField(blank=True)), ('internal', models.BooleanField(default=False, verbose_name='Intern')), ('pub_date', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Publication date')), ('thumbnail', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='files.Image')), @@ -39,8 +38,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=100, verbose_name='Tittel')), - ('main_content', ckeditor_uploader.fields.RichTextUploadingField(blank=True, verbose_name='Artikkel')), - ('ingress_content', ckeditor_uploader.fields.RichTextUploadingField(blank=True, verbose_name='Ingress')), + ('main_content', models.TextField(blank=True, verbose_name='Artikkel')), + ('ingress_content', models.TextField(blank=True, verbose_name='Ingress')), ('pub_date', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Publiseringsdato')), ('internal', models.BooleanField(default=False, verbose_name='Intern')), ('registration', models.BooleanField(default=False, verbose_name='Påmelding')), diff --git a/news/migrations/0028_auto_20210210_2032.py b/news/migrations/0028_auto_20210210_2032.py index e93cc6ad5..e40dfeb57 100644 --- a/news/migrations/0028_auto_20210210_2032.py +++ b/news/migrations/0028_auto_20210210_2032.py @@ -1,6 +1,5 @@ # Generated by Django 3.1.1 on 2021-02-10 20:32 -import ckeditor_uploader.fields import django.core.validators from django.db import migrations, models @@ -25,7 +24,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='article', name='main_content', - field=ckeditor_uploader.fields.RichTextUploadingField(blank=True, verbose_name='Brødtekst'), + field=models.TextField(blank=True, verbose_name='Brødtekst'), ), migrations.AlterField( model_name='article', @@ -40,6 +39,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='event', name='main_content', - field=ckeditor_uploader.fields.RichTextUploadingField(blank=True, verbose_name='Hovedtekst'), + field=models.TextField(blank=True, verbose_name='Hovedtekst'), ), ] diff --git a/news/templates/news/article.html b/news/templates/news/article.html index 5f8ac5539..8e4e2dad4 100644 --- a/news/templates/news/article.html +++ b/news/templates/news/article.html @@ -164,19 +164,4 @@
{% trans 'Neste artikkel' %}
- {% endblock content %} diff --git a/news/templates/news/edit_article.html b/news/templates/news/edit_article.html index bc84dcc1d..66f22359d 100644 --- a/news/templates/news/edit_article.html +++ b/news/templates/news/edit_article.html @@ -3,8 +3,6 @@ {% load static %} {% block head %} - - {% endblock head %} diff --git a/news/templates/news/edit_event.html b/news/templates/news/edit_event.html index 791396ce7..09bfcab83 100644 --- a/news/templates/news/edit_event.html +++ b/news/templates/news/edit_event.html @@ -3,8 +3,6 @@ {% load static %} {% block head %} - - {% endblock head %} diff --git a/news/templates/news/event.html b/news/templates/news/event.html index 0c561347b..b985086a1 100644 --- a/news/templates/news/event.html +++ b/news/templates/news/event.html @@ -219,19 +219,4 @@

{% trans 'Informasjon om påmelding' %}

- - {% endblock content %} diff --git a/projectarchive/migrations/0001_initial.py b/projectarchive/migrations/0001_initial.py index 6093e98a3..c26d40c4d 100644 --- a/projectarchive/migrations/0001_initial.py +++ b/projectarchive/migrations/0001_initial.py @@ -1,6 +1,5 @@ # Generated by Django 3.1.7 on 2022-01-19 20:29 -import ckeditor_uploader.fields from django.conf import settings import django.core.validators from django.db import migrations, models @@ -33,7 +32,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=100, verbose_name='Tittel')), - ('main_content', ckeditor_uploader.fields.RichTextUploadingField(blank=True, verbose_name='Brødtekst')), + ('main_content', models.TextField(blank=True, verbose_name='Brødtekst')), ('ingress_content', models.TextField(blank=True, help_text='En kort introduksjon til teksten', max_length=400, validators=[django.core.validators.MaxLengthValidator(400)], verbose_name='Ingress')), ('internal', models.BooleanField(default=False, verbose_name='Intern artikkel')), ('pub_date', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Publication date')), diff --git a/projectarchive/templates/projectarchive/article.html b/projectarchive/templates/projectarchive/article.html index dc30cb3b9..349aa7639 100644 --- a/projectarchive/templates/projectarchive/article.html +++ b/projectarchive/templates/projectarchive/article.html @@ -78,19 +78,4 @@
Administrator-meny
- {% endblock content %} diff --git a/projectarchive/templates/projectarchive/edit_article.html b/projectarchive/templates/projectarchive/edit_article.html index a30a35bed..548a7dfc1 100644 --- a/projectarchive/templates/projectarchive/edit_article.html +++ b/projectarchive/templates/projectarchive/edit_article.html @@ -3,8 +3,6 @@ {% load i18n %} {% block head %} - - {% endblock head %} diff --git a/userprofile/migrations/0026_auto_20200211_1917.py b/userprofile/migrations/0026_auto_20200211_1917.py index 497ace565..5bdddc8be 100644 --- a/userprofile/migrations/0026_auto_20200211_1917.py +++ b/userprofile/migrations/0026_auto_20200211_1917.py @@ -1,6 +1,5 @@ # Generated by Django 3.0.2 on 2020-02-11 19:17 -import ckeditor_uploader.fields from django.db import migrations, models import django.utils.timezone @@ -20,6 +19,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='termsofservice', name='text', - field=ckeditor_uploader.fields.RichTextUploadingField(blank=True), + field=models.TextField(blank=True), ), ] diff --git a/userprofile/migrations/0027_auto_20200211_1945.py b/userprofile/migrations/0027_auto_20200211_1945.py index 90523f315..ed9082b27 100644 --- a/userprofile/migrations/0027_auto_20200211_1945.py +++ b/userprofile/migrations/0027_auto_20200211_1945.py @@ -1,7 +1,6 @@ # Generated by Django 3.0.2 on 2020-02-11 19:45 -import ckeditor.fields -from django.db import migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -14,6 +13,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='termsofservice', name='text', - field=ckeditor.fields.RichTextField(blank=True), + field=models.TextField(blank=True), ), ] diff --git a/userprofile/migrations/0029_auto_20200304_2007.py b/userprofile/migrations/0029_auto_20200304_2007.py index 120106c39..149697ce3 100644 --- a/userprofile/migrations/0029_auto_20200304_2007.py +++ b/userprofile/migrations/0029_auto_20200304_2007.py @@ -1,6 +1,5 @@ # Generated by Django 3.0.2 on 2020-03-04 20:07 -import ckeditor.fields from django.db import migrations, models @@ -26,7 +25,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='termsofservice', name='text', - field=ckeditor.fields.RichTextField(), + field=models.TextField(), ), migrations.DeleteModel( name='Skill', diff --git a/userprofile/templates/userprofile/create_tos.html b/userprofile/templates/userprofile/create_tos.html index 284524ad6..cd28a24b7 100644 --- a/userprofile/templates/userprofile/create_tos.html +++ b/userprofile/templates/userprofile/create_tos.html @@ -3,8 +3,6 @@ {% block head %} {{ jquery | safe }} - - {% endblock head %} {% block content %} diff --git a/website/migrations/0014_auto_20210412_1918.py b/website/migrations/0014_auto_20210412_1918.py index bf757a95e..82bde69ab 100644 --- a/website/migrations/0014_auto_20210412_1918.py +++ b/website/migrations/0014_auto_20210412_1918.py @@ -1,7 +1,6 @@ # Generated by Django 3.1.1 on 2021-04-12 19:18 -import ckeditor.fields -from django.db import migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -14,6 +13,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='rule', name='body', - field=ckeditor.fields.RichTextField(), + field=models.TextField(), ), ] diff --git a/website/migrations/0015_auto_20210412_1921.py b/website/migrations/0015_auto_20210412_1921.py index c1465ef1a..f6fbd603b 100644 --- a/website/migrations/0015_auto_20210412_1921.py +++ b/website/migrations/0015_auto_20210412_1921.py @@ -1,7 +1,6 @@ # Generated by Django 3.1.1 on 2021-04-12 19:21 -import ckeditor_uploader.fields -from django.db import migrations +from django.db import migrations, models, models class Migration(migrations.Migration): @@ -14,6 +13,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='rule', name='body', - field=ckeditor_uploader.fields.RichTextUploadingField(), + field=models.TextField(), ), ] diff --git a/website/migrations/0016_auto_20210412_1944.py b/website/migrations/0016_auto_20210412_1944.py index 545d819e4..0f209069c 100644 --- a/website/migrations/0016_auto_20210412_1944.py +++ b/website/migrations/0016_auto_20210412_1944.py @@ -1,7 +1,6 @@ # Generated by Django 3.1.1 on 2021-04-12 19:44 -import ckeditor.fields -from django.db import migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -14,6 +13,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='rule', name='body', - field=ckeditor.fields.RichTextField(), + field=models.TextField(), ), ] diff --git a/website/static/website/css/style.css b/website/static/website/css/style.css index a837af068..4e18c38d0 100644 --- a/website/static/website/css/style.css +++ b/website/static/website/css/style.css @@ -158,10 +158,6 @@ strong { align-self: center; } -/* CKEditor override */ -.django-ckeditor-widget { - width: 100%; -} /* GENERELL STYLING OG MATERIAL OVERRIDES BEGYNNER HER */ .card-action a { color: #5BBA47 !important; diff --git a/website/urls.py b/website/urls.py index a5fe749a4..54728e081 100644 --- a/website/urls.py +++ b/website/urls.py @@ -1,7 +1,5 @@ -from ckeditor_uploader import views as ck_upload_views from django.conf import settings from django.contrib import admin -from django.contrib.auth.decorators import permission_required from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.urls import include, path, re_path from django.views.generic import TemplateView @@ -56,17 +54,6 @@ path("tos//", TermsOfServiceView.as_view(), name="tos-details"), path("news/", include("news.urls")), path("events/", include("news.event_urls")), - path("ckeditor/", include("ckeditor_uploader.urls")), - path( - "ckeditor/upload", - permission_required("news.add_article")(ck_upload_views.upload), - name="ckeditor_upload", - ), - path( - "ckeditor/browse", - permission_required("news.add_article")(ck_upload_views.browse), - name="ckeditor_browse", - ), path("authentication/", include("authentication.urls", namespace="auth")), path("door/", include("door.urls")), path("opptak/", include("applications.urls"), name="opptak"), From 5dbadcc6939892142332ce7d9f23507fc515d1d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20G=C3=BCtzkow?= <70779496+CJGutz@users.noreply.github.com> Date: Wed, 10 Apr 2024 20:32:47 +0200 Subject: [PATCH 3/3] new make migrations after conflict migrations --- ...ter_item_description.py => 0031_alter_item_description.py} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename inventory/migrations/{0030_alter_item_description.py => 0031_alter_item_description.py} (77%) diff --git a/inventory/migrations/0030_alter_item_description.py b/inventory/migrations/0031_alter_item_description.py similarity index 77% rename from inventory/migrations/0030_alter_item_description.py rename to inventory/migrations/0031_alter_item_description.py index 741aa5a51..a2613a3fd 100644 --- a/inventory/migrations/0030_alter_item_description.py +++ b/inventory/migrations/0031_alter_item_description.py @@ -1,4 +1,4 @@ -# Generated by Django 5.0.3 on 2024-03-16 17:47 +# Generated by Django 5.0.3 on 2024-04-10 20:32 import markdownx.models from django.db import migrations @@ -7,7 +7,7 @@ class Migration(migrations.Migration): dependencies = [ - ('inventory', '0029_equipment'), + ('inventory', '0030_alter_itemloan_loan_from'), ] operations = [