{% extends "bee_django_course/base.html" %}
{% load static %}
{% load bootstrap3 %}
{% block content %}
    <form method="post" enctype="multipart/form-data">
        {% csrf_token %}

        {% bootstrap_form form %}
        {{ formset.management_form }}
        {% bootstrap_formset formset %}
        {% bootstrap_button '提交' %}
    </form>
{% endblock %}

{% block scripts %}
    <script type="text/javascript">
        $(document).ready(function () {

            var E = window.wangEditor;
            var editor = new E('id_info');
            editor.config.menus = [
                'source',
                '|',
                'bold',
                'underline',
                'italic',
                'strikethrough',
                'eraser',
                'forecolor',
                'bgcolor',
                '|',
                'quote',
                'fontfamily',
                'fontsize',
                'head',
                'unorderlist',
                'orderlist',
                'alignleft',
                'aligncenter',
                'alignright',
                '|',
                'link',
                'unlink',
                'table',
                'emotion',
                '|',
                'img',
                'video',
                'location',
                'insertcode',
            ];

            editor.config.uploadImgFileName = 'image';
            editor.config.uploadImgUrl = "{% url 'bee_django_course:upload_image' %}";
            editor.create();

            window.editor = editor;
        });
    </script>
{% endblock %}