Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- view
- +++++++++++++++++++++++++++++++++++
- from django.forms import Form, CharField
- class TestForm(Form):
- field = CharField(widget=SummernoteWidget())
- def upload_image_view(request):
- form = TestForm
- return render(request, 'test.html', {'form': form})
- template
- ++++++++++++++++++++++++++++++++++++
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- </head>
- <body>
- <form action="" enctype="multipart/form-data" method="post">
- {% csrf_token %}
- {% for field in form %}
- {{ field }}
- {% endfor %}
- <button href=""> Send</button>
- </form>
- </body>
- </html>
- +++++++++++++++++++++
- settings
- SUMMERNOTE_CONFIG = {
- 'iframe': True,
- 'airMode': False,
- 'styleWithTags': True,
- 'direction': 'ltr',
- 'width': '100%',
- 'lang': 'ru-RU',
- 'toolbar': [
- ['style', ['style']],
- ['style', ['bold', 'italic', 'underline', 'clear']],
- ['para', ['ul', 'ol', 'height']],
- ['insert', ['link', 'picture', 'video', 'hr'] ],
- ],
- 'base_css': (
- '//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css',
- ),
- 'base_js': (
- '//code.jquery.com/jquery-1.9.1.min.js',
- '//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js',
- ),
- 'default_css': (
- os.path.join(STATIC_URL, 'django_summernote/summernote.css'),
- os.path.join(STATIC_URL, 'django_summernote/django_summernote.css'),
- ),
- 'default_js': (
- os.path.join(STATIC_URL, 'django_summernote/jquery.ui.widget.js'),
- os.path.join(STATIC_URL, 'django_summernote/jquery.iframe-transport.js'),
- os.path.join(STATIC_URL, 'django_summernote/jquery.fileupload.js'),
- os.path.join(STATIC_URL, 'django_summernote/summernote.min.js'),
- ),
- 'disable_upload': False,
- 'lazy': True,
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement