JensDiemer 2022-09-13 20:14:54 +02:00
rodzic 762dc492bb
commit 16fde73274
7 zmienionych plików z 776 dodań i 199 usunięć

Wyświetl plik

@ -156,6 +156,7 @@ Files are separated into: "/src/" and "/development/"
* [**dev**](https://github.com/jedie/PyInventory/compare/v0.15.0...main)
* Update requirements
* Bugfix missing CK-Editor
* Replace Creole base README with markdown
* Remove Docker stuff from README
* tbc

924
poetry.lock wygenerowano

Plik diff jest za duży Load Diff

Wyświetl plik

@ -49,7 +49,12 @@ django-import-export = "*" # https://github.com/django-import-export/django-imp
django-dbbackup = "*" # https://github.com/django-dbbackup/django-dbbackup
django-tools = ">=0.49.0" # https://github.com/jedie/django-tools/
django-reversion-compare = "*" # https://github.com/jedie/django-reversion-compare/
django-ckeditor = "*" # https://github.com/django-ckeditor/django-ckeditor
# Skip Version 6.3.1-6.3.x
# Because [1] brokes the form widget!
# [1] https://github.com/django-ckeditor/django-ckeditor/commit/6665cb73a11d37216cd83c4b9e85bf4291fa73e6
django-ckeditor = "<=6.3.0,<=6.4.0" # https://github.com/django-ckeditor/django-ckeditor
bx_py_utils = "*" # https://github.com/boxine/bx_py_utils
bx_django_utils = "*" # https://github.com/boxine/bx_django_utils
django-tagulous = "*" # https://github.com/radiac/django-tagulous

Wyświetl plik

@ -120,8 +120,9 @@
<label for="id_description">
Description:
</label>
<textarea class="vLargeTextField" cols="40" id="id_description" name="description" rows="10">
</textarea>
<div class="django-ckeditor-widget" data-field-id="id_description" style="display: inline-block;">
<textarea cols="40" data-config='{"skin": "moono-lisa", "toolbar_Basic": [["Source", "-", "Bold", "Italic"]], "toolbar_Full": [["Styles", "Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker", "Undo", "Redo"], ["Link", "Unlink", "Anchor"], ["Image", "Flash", "Table", "HorizontalRule"], ["TextColor", "BGColor"], ["Smiley", "SpecialChar"], ["Source"]], "toolbar": "PyInventoryToolbarConfig", "height": "25em", "width": "100%", "filebrowserWindowWidth": 940, "filebrowserWindowHeight": 725, "removeButtons": "Language,Cut,Copy,Paste,Undo,Redo,Anchor", "removePlugins": ["a11yhelp", "adobeair", "ajax", "autoembed", "autolink", "bbcode", "bidi", "clipboard", "codesnippet", "codesnippetgeshi", "contextmenu", "copyformatting", "devtools", "dialog", "dialogadvtab", "div", "divarea", "docprops", "embed", "embedbase", "embedsemantic", "enterkey", "exportpdf", "find", "flash", "forms", "htmlwriter", "iframe", "iframedialog", "language", "magicline", "mathjax", "newpage", "notification", "notificationaggregator", "pagebreak", "pastefromgdocs", "pastefromword", "pastetext", "pastetools", "placeholder", "preview", "print", "save", "scayt", "selectall", "sharedspace", "smiley", "sourcedialog", "specialchar", "stylescombo", "stylesheetparser", "tab", "templates", "uicolor", "widget", "wsc", "xml"], "toolbar_PyInventoryToolbarConfig": [{"name": "basicstyles", "items": ["Bold", "Italic", "Underline", "Strike", "-", "RemoveFormat"]}, {"name": "paragraph", "items": ["NumberedList", "BulletedList", "-", "Outdent", "Indent", "-", "Blockquote", "-", "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock"]}, {"name": "links", "items": ["Link", "Unlink", "Anchor"]}, {"name": "insert", "items": ["Image", "Table", "HorizontalRule"]}, "/", {"name": "styles", "items": ["Styles", "Format", "Font", "FontSize"]}, {"name": "colors", "items": ["TextColor", "BGColor"]}, {"name": "tools", "items": ["Maximize", "ShowBlocks", "Source"]}, {"name": "about", "items": ["About"]}], "filebrowserUploadUrl": "/ckeditor/upload/", "filebrowserBrowseUrl": "/ckeditor/browse/", "language": "en"}' data-external-plugin-resources="[]" data-id="id_description" data-processed="0" data-type="ckeditortype" id="id_description" name="description" rows="10"></textarea>
</div>
<div class="help">
</div>
</div>

Wyświetl plik

@ -21,6 +21,8 @@
</script>
<script src="/static/tagulous/tagulous.js">
</script>
<script data-ckeditor-basepath="/static/ckeditor/ckeditor/" id="ckeditor-init-script" src="/static/ckeditor/ckeditor-init.js">
</script>
<script src="/static/admin/js/calendar.js">
</script>
<script src="/static/admin/js/collapse.js">
@ -29,6 +31,8 @@
</script>
<script src="/static/tagulous/adaptor/select2-4.js">
</script>
<script src="/static/ckeditor/ckeditor/ckeditor.js">
</script>
<script src="/static/admin/js/admin/DateTimeShortcuts.js">
</script>
<script src="/static/admin/js/vendor/select2/i18n/en.js">
@ -327,8 +331,9 @@
<label for="id_description">
Description:
</label>
<textarea class="vLargeTextField" cols="40" id="id_description" name="description" rows="10">
</textarea>
<div class="django-ckeditor-widget" data-field-id="id_description" style="display: inline-block;">
<textarea cols="40" data-config='{"skin": "moono-lisa", "toolbar_Basic": [["Source", "-", "Bold", "Italic"]], "toolbar_Full": [["Styles", "Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker", "Undo", "Redo"], ["Link", "Unlink", "Anchor"], ["Image", "Flash", "Table", "HorizontalRule"], ["TextColor", "BGColor"], ["Smiley", "SpecialChar"], ["Source"]], "toolbar": "PyInventoryToolbarConfig", "height": "25em", "width": "100%", "filebrowserWindowWidth": 940, "filebrowserWindowHeight": 725, "removeButtons": "Language,Cut,Copy,Paste,Undo,Redo,Anchor", "removePlugins": ["a11yhelp", "adobeair", "ajax", "autoembed", "autolink", "bbcode", "bidi", "clipboard", "codesnippet", "codesnippetgeshi", "contextmenu", "copyformatting", "devtools", "dialog", "dialogadvtab", "div", "divarea", "docprops", "embed", "embedbase", "embedsemantic", "enterkey", "exportpdf", "find", "flash", "forms", "htmlwriter", "iframe", "iframedialog", "language", "magicline", "mathjax", "newpage", "notification", "notificationaggregator", "pagebreak", "pastefromgdocs", "pastefromword", "pastetext", "pastetools", "placeholder", "preview", "print", "save", "scayt", "selectall", "sharedspace", "smiley", "sourcedialog", "specialchar", "stylescombo", "stylesheetparser", "tab", "templates", "uicolor", "widget", "wsc", "xml"], "toolbar_PyInventoryToolbarConfig": [{"name": "basicstyles", "items": ["Bold", "Italic", "Underline", "Strike", "-", "RemoveFormat"]}, {"name": "paragraph", "items": ["NumberedList", "BulletedList", "-", "Outdent", "Indent", "-", "Blockquote", "-", "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock"]}, {"name": "links", "items": ["Link", "Unlink", "Anchor"]}, {"name": "insert", "items": ["Image", "Table", "HorizontalRule"]}, "/", {"name": "styles", "items": ["Styles", "Format", "Font", "FontSize"]}, {"name": "colors", "items": ["TextColor", "BGColor"]}, {"name": "tools", "items": ["Maximize", "ShowBlocks", "Source"]}, {"name": "about", "items": ["About"]}], "filebrowserUploadUrl": "/ckeditor/upload/", "filebrowserBrowseUrl": "/ckeditor/browse/", "language": "en"}' data-external-plugin-resources="[]" data-id="id_description" data-processed="0" data-type="ckeditortype" id="id_description" name="description" rows="10"></textarea>
</div>
<div class="help">
</div>
</div>

Wyświetl plik

@ -98,8 +98,9 @@
<label for="id_memo">
Description:
</label>
<textarea class="vLargeTextField" cols="40" id="id_memo" name="memo" rows="10">
</textarea>
<div class="django-ckeditor-widget" data-field-id="id_memo" style="display: inline-block;">
<textarea cols="40" data-config='{"skin": "moono-lisa", "toolbar_Basic": [["Source", "-", "Bold", "Italic"]], "toolbar_Full": [["Styles", "Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker", "Undo", "Redo"], ["Link", "Unlink", "Anchor"], ["Image", "Flash", "Table", "HorizontalRule"], ["TextColor", "BGColor"], ["Smiley", "SpecialChar"], ["Source"]], "toolbar": "PyInventoryToolbarConfig", "height": "25em", "width": "100%", "filebrowserWindowWidth": 940, "filebrowserWindowHeight": 725, "removeButtons": "Language,Cut,Copy,Paste,Undo,Redo,Anchor", "removePlugins": ["a11yhelp", "adobeair", "ajax", "autoembed", "autolink", "bbcode", "bidi", "clipboard", "codesnippet", "codesnippetgeshi", "contextmenu", "copyformatting", "devtools", "dialog", "dialogadvtab", "div", "divarea", "docprops", "embed", "embedbase", "embedsemantic", "enterkey", "exportpdf", "find", "flash", "forms", "htmlwriter", "iframe", "iframedialog", "language", "magicline", "mathjax", "newpage", "notification", "notificationaggregator", "pagebreak", "pastefromgdocs", "pastefromword", "pastetext", "pastetools", "placeholder", "preview", "print", "save", "scayt", "selectall", "sharedspace", "smiley", "sourcedialog", "specialchar", "stylescombo", "stylesheetparser", "tab", "templates", "uicolor", "widget", "wsc", "xml"], "toolbar_PyInventoryToolbarConfig": [{"name": "basicstyles", "items": ["Bold", "Italic", "Underline", "Strike", "-", "RemoveFormat"]}, {"name": "paragraph", "items": ["NumberedList", "BulletedList", "-", "Outdent", "Indent", "-", "Blockquote", "-", "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock"]}, {"name": "links", "items": ["Link", "Unlink", "Anchor"]}, {"name": "insert", "items": ["Image", "Table", "HorizontalRule"]}, "/", {"name": "styles", "items": ["Styles", "Format", "Font", "FontSize"]}, {"name": "colors", "items": ["TextColor", "BGColor"]}, {"name": "tools", "items": ["Maximize", "ShowBlocks", "Source"]}, {"name": "about", "items": ["About"]}], "filebrowserUploadUrl": "/ckeditor/upload/", "filebrowserBrowseUrl": "/ckeditor/browse/", "language": "en"}' data-external-plugin-resources="[]" data-id="id_memo" data-processed="0" data-type="ckeditortype" id="id_memo" name="memo" rows="10"></textarea>
</div>
<div class="help">
</div>
</div>

Wyświetl plik

@ -0,0 +1,24 @@
from ckeditor.widgets import CKEditorWidget
from ckeditor_uploader.fields import RichTextUploadingField, RichTextUploadingFormField
from django.forms import modelform_factory
from django.test import TestCase
from inventory.models import ItemModel
class ItemModelTestCase(TestCase):
def test_item_description_ckeditor(self):
item = ItemModel()
opts = item._meta
model_description_field = opts.get_field('description')
self.assertIsInstance(model_description_field, RichTextUploadingField)
def test_item_description_form_ckeditor(self):
ItemForm = modelform_factory(ItemModel, fields=('description',))
form = ItemForm()
form_field = form.fields['description']
self.assertIsInstance(form_field, RichTextUploadingFormField)
widget = form_field.widget
# Note: django-ckeditor 6.3.1-6.3.x broke the widget loading:
self.assertIsInstance(widget, CKEditorWidget)