{"id":14771372,"url":"https://github.com/lqez/django-summernote","last_synced_at":"2026-03-15T06:54:44.317Z","repository":{"id":38707721,"uuid":"11448592","full_name":"lqez/django-summernote","owner":"lqez","description":"Simply integrate Summernote editor with Django project. ","archived":false,"fork":false,"pushed_at":"2024-06-07T12:24:13.000Z","size":1906,"stargazers_count":1084,"open_issues_count":77,"forks_count":233,"subscribers_count":35,"default_branch":"main","last_synced_at":"2025-12-16T20:58:18.901Z","etag":null,"topics":["django","summernote","wysiwyg"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lqez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-16T12:07:21.000Z","updated_at":"2025-12-02T21:13:53.000Z","dependencies_parsed_at":"2024-01-11T17:47:27.524Z","dependency_job_id":"aa1f9d1b-7d2e-4b3c-8fda-82203040dbbf","html_url":"https://github.com/lqez/django-summernote","commit_stats":{"total_commits":463,"total_committers":69,"mean_commits":"6.7101449275362315","dds":0.5053995680345572,"last_synced_commit":"8b17863d44ad1a588ea46d79203461275456e654"},"previous_names":["hackerwins/django-summernote","lqez/django-summernote"],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/lqez/django-summernote","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqez%2Fdjango-summernote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqez%2Fdjango-summernote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqez%2Fdjango-summernote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqez%2Fdjango-summernote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lqez","download_url":"https://codeload.github.com/lqez/django-summernote/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lqez%2Fdjango-summernote/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27798558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-18T02:00:09.725Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","summernote","wysiwyg"],"created_at":"2024-09-16T16:02:15.878Z","updated_at":"2025-12-18T15:05:45.640Z","avatar_url":"https://github.com/lqez.png","language":"Python","funding_links":[],"categories":["Python","Third-Party Packages"],"sub_categories":["Editors"],"readme":"django-summernote\n=================\n[![Build Status](https://img.shields.io/travis/summernote/django-summernote.svg)](https://travis-ci.org/summernote/django-summernote)\n[![Coverage Status](https://coveralls.io/repos/github/summernote/django-summernote/badge.svg?branch=master)](https://coveralls.io/github/summernote/django-summernote?branch=master)\n\n[Summernote](https://github.com/summernote/summernote) is a simple WYSIWYG editor.\n\n`django-summernote` allows you to embed Summernote into Django very handy. Support admin mixins and widgets.\n\n![django-summernote](https://raw.github.com/lqez/pastebin/master/img/django-summernote.png \"Screenshot of django-summernote\")\n\n\nSETUP\n-----\n\n1. Install `django-summernote` to your python environment.\n\n       pip install django-summernote\n\n2. Add `django_summernote` to `INSTALLED_APPS` in `settings.py`.\n\n       INSTALLED_APPS += ('django_summernote', )\n\n3. Add `django_summernote.urls` to `urls.py`.\n\n       from django.urls import include\n       # ...\n       urlpatterns = [\n           ...\n           path('summernote/', include('django_summernote.urls')),\n           ...\n       ]\n\n4. Be sure to set proper `MEDIA_URL` for attachments.\n     - The following is an example test code:\n\n           MEDIA_URL = '/media/'\n           MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')\n\n     - When debug option is enabled(```DEBUG=True```), DO NOT forget to add urlpatterns as shown below:\n\n           from django.conf import settings\n           from django.conf.urls.static import static\n\n           if settings.DEBUG:\n               urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n\n     - Please, read the [official v3.0 documentation](https://docs.djangoproject.com/en/3.0/topics/files/) for more details on file uploads.\n\n5. Run database migration for preparing attachment model.\n\n       python manage.py migrate\n\n6. Collect static files before publishing or development.\n\n       python manage.py collectstatic\n\nUSAGE\n-----\n## Django admin site\n### Apply summernote to all TextField in model\nIn `admin.py`,\n\n```python\nfrom django_summernote.admin import SummernoteModelAdmin\nfrom .models import SomeModel\n\n# Apply summernote to all TextField in model.\nclass SomeModelAdmin(SummernoteModelAdmin):  # instead of ModelAdmin\n    summernote_fields = '__all__'\n\nadmin.site.register(SomeModel, SomeModelAdmin)\n```\n\n### Apply summernote only to specific TextField in model\nAlthough `Post` model has several TextField, only `content` field will have `SummernoteWidget`.\n\nIn `admin.py`,\n\n```python\nfrom django_summernote.admin import SummernoteModelAdmin\nfrom .models import Post\n\nclass PostAdmin(SummernoteModelAdmin):\n    summernote_fields = ('content',)\n\nadmin.site.register(Post, PostAdmin)\n```\n\n## Form\nIn `forms`,\n\n```python\nfrom django_summernote.widgets import SummernoteWidget, SummernoteInplaceWidget\n\n# Apply summernote to specific fields.\nclass SomeForm(forms.Form):\n    foo = forms.CharField(widget=SummernoteWidget())  # instead of forms.Textarea\n\n# If you don't like \u003ciframe\u003e, then use inplace widget\n# Or if you're using django-crispy-forms, please use this.\nclass AnotherForm(forms.Form):\n    bar = forms.CharField(widget=SummernoteInplaceWidget())\n```\n\nAnd for `ModelForm`,\n\n```python\nclass FormFromSomeModel(forms.ModelForm):\n    class Meta:\n        model = SomeModel\n        widgets = {\n            'foo': SummernoteWidget(),\n            'bar': SummernoteInplaceWidget(),\n        }\n```\n\nLast, please don't forget to use `safe` templatetag while displaying in templates.\n\n    {{ foobar|safe }}\n\n__Warning__: Please mind, that the widget does not provide any escaping. If you expose the widget to external users without taking care of this, it could potentially lead to an injection vulnerability. Therefore you can use the SummernoteTextFormField or SummernoteTextField, which escape all harmful tags through mozilla's package bleach:\n\nIn `forms`,\n```python\nfrom django_summernote.fields import SummernoteTextFormField, SummernoteTextField\n\nclass SomeForm(forms.Form):\n    foo = SummernoteTextFormField()\n\n```\n\nAnd for `ModelForm`,\n\n```python\nclass FormForSomeModel(forms.ModelForm):\n    foo = SummernoteTextField()\n```\n\nTHEMES\n------\n\ndjango-summernote is served with Bootstrap3 by default, but you can choose other options.\nYou can change the theme by setting `SUMMERNOTE_THEME = '\u003ctheme_name\u003e'` in `settings.py`.\n\n`SUMMERNOTE_THEME` accepts the following values:\n\n - `bs3`: Bootstrap3 theme\n - `bs4`: Bootstrap4 theme\n - `bs5`: Bootstrap5 theme\n - `lite`: Lite UI theme (without Bootstrap)\n\nIn settings.py\n\n```python\nSUMMERNOTE_THEME = 'bs4'  # Show summernote with Bootstrap4\n```\n\nOPTIONS\n-------\n\nSupport customization via settings.\nPut `SUMMERNOTE_CONFIG` into your settings file.\n\nIn settings.py,\n\n```python\nSUMMERNOTE_CONFIG = {\n    # Using SummernoteWidget - iframe mode, default\n    'iframe': True,\n\n    # Or, you can set it to `False` to use SummernoteInplaceWidget by default - no iframe mode\n    # In this case, you have to load Bootstrap/jQuery sources and dependencies manually.\n    # Use this when you're already using Bootstrap/jQuery based themes.\n    'iframe': False,\n\n    # You can put custom Summernote settings\n    'summernote': {\n        # As an example, using Summernote Air-mode\n        'airMode': False,\n\n        # Change editor size\n        'width': '100%',\n        'height': '480',\n\n        # Use proper language setting automatically (default)\n        'lang': None,\n\n        # Toolbar customization\n        # https://summernote.org/deep-dive/#custom-toolbar-popover\n        'toolbar': [\n            ['style', ['style']],\n            ['font', ['bold', 'underline', 'clear']],\n            ['fontname', ['fontname']],\n            ['color', ['color']],\n            ['para', ['ul', 'ol', 'paragraph']],\n            ['table', ['table']],\n            ['insert', ['link', 'picture', 'video']],\n            ['view', ['fullscreen', 'codeview', 'help']],\n        ],\n\n        # Or, explicitly set language/locale for editor\n        'lang': 'ko-KR',\n        ...\n\n        # You can also add custom settings for external plugins\n        'print': {\n            'stylesheetUrl': '/some_static_folder/printable.css',\n        },\n        'codemirror': {\n            'mode': 'htmlmixed',\n            'lineNumbers': 'true',\n            # You have to include theme file in 'css' or 'css_for_inplace' before using it.\n            'theme': 'monokai',\n        },\n    },\n\n    # Require users to be authenticated for uploading attachments.\n    'attachment_require_authentication': True,\n\n    # Set `upload_to` function for attachments.\n    'attachment_upload_to': my_custom_upload_to_func(),\n\n    # Set custom storage class for attachments.\n    'attachment_storage_class': 'my.custom.storage.class.name',\n\n    # Set custom model for attachments (default: 'django_summernote.Attachment')\n    'attachment_model': 'my.custom.attachment.model', # must inherit 'django_summernote.AbstractAttachment'\n\n    # You can completely disable the attachment feature.\n    'disable_attachment': False,\n\n    # Set to `False` to return attachment paths in relative URIs.\n    'attachment_absolute_uri': True,\n\n    # test_func in summernote upload view. (Allow upload images only when user passes the test)\n    # https://docs.djangoproject.com/en/2.2/topics/auth/default/#django.contrib.auth.mixins.UserPassesTestMixin\n    ```\n    def example_test_func(request):\n        return request.user.groups.filter(name='group_name').exists()\n    ```\n    'test_func_upload_view': example_test_func,\n\n    # You can add custom css/js for SummernoteWidget.\n    'css': (\n    ),\n    'js': (\n    ),\n\n    # You can also add custom css/js for SummernoteInplaceWidget.\n    # !!! Be sure to put {{ form.media }} in template before initiate summernote.\n    'css_for_inplace': (\n    ),\n    'js_for_inplace': (\n    ),\n\n    # Codemirror as codeview\n    # If any codemirror settings are defined, it will include codemirror files automatically.\n    'css': (\n        '//cdnjs.cloudflare.com/ajax/libs/codemirror/5.29.0/theme/monokai.min.css',\n    ),\n\n    # Lazy initialization\n    # If you want to initialize summernote at the bottom of page, set this as True\n    # and call `initSummernote()` on your page.\n    'lazy': True,\n\n    # To use external plugins,\n    # Include them within `css` and `js`.\n    'js': {\n        '/some_static_folder/summernote-ext-print.js',\n        '//somewhere_in_internet/summernote-plugin-name.js',\n    },\n}\n```\n\n  - There are pre-defined css/js files for widgets.\n    - See them at [summernote default settings](https://github.com/summernote/django-summernote/blob/master/django_summernote/settings.py#L106-L133)\n  - About language/locale: [Summernote i18n section](http://summernote.org/getting-started/#i18n-support)\n  - About Air-mode, see [Summernote air-mode example page](http://summernote.org/examples/#air-mode).\n  - About toolbar customization, please refer [Summernote toolbar section](http://summernote.org/deep-dive/#custom-toolbar-popover).\n\nYou can style the editor via widget's attributes. These adhoc styling will override settings from `SUMMERNOTE_CONFIG`.\n\n```python\n# Apply adhoc style via attributes\nclass SomeForm(forms.Form):\n    foo = forms.CharField(widget=SummernoteWidget(attrs={'summernote': {'width': '50%', 'height': '400px'}}))\n```\n\nYou can also pass additional parameters to custom `Attachment` model by adding attributes to SummernoteWidget or SummernoteInplaceWidget, any attribute starting with `data-` will be pass to the `save(...)` method of custom `Attachment` model as `**kwargs`.\n\n```python\n# Pass additional parameters to Attachment via attributes\nclass SomeForm(forms.Form):\n    foo = forms.CharField(widget=SummernoteWidget(attrs={'data-user-id': 123456, 'data-device': 'iphone'}))\n```\n\nTEST\n----\n\nRun `tox`. If you don't have it, just `pip install tox`\n\nYou can also run test with only specified targets.\n```\n$ tox -e py36-dj202,py39-dj302\n```\n\n\nLIMITATIONS\n-----------\n\n`django-summernote` does currently not support upload of non-image files.\n\n\nLICENSE\n-------\n\n`django-summernote` is distributed under MIT license and proudly served by great contributors.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flqez%2Fdjango-summernote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flqez%2Fdjango-summernote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flqez%2Fdjango-summernote/lists"}