{% extends "base.html" %}
{% load static %}
{% block title %}
    发表文章
{% endblock title %}
{% block style %}
    <link rel="stylesheet" type="text/css" href="{% static 'L_header.css' %}">
{% endblock style %}
{% block content %}
    <div class="container mt-5">
        <div class="row">
            <div class="col-12">
                <br>
                <!-- 提交文章的表单 -->
                <form method="post" action="." enctype="multipart/form-data">
                    <!-- Django中需要POST数据的地方都必须有csrf_token -->
                    {% csrf_token %}
                    <div class="form-group">
                        <label for="title">
                            文章标题
                        </label>
                        <input type="text" class="form-control" id="title" name="title">
                    </div>
                    <!--文章标题图-->
                    <div class="form-group">
                        <label for="avatar">标题图</label>
                        <input type="file" class="form-control-file" name="avatar" id="avatar">
                    </div>
                    <!--文章类别-->
                    <div class="form-group">
                        <label for="column">分类</label>
                        <select class="form-control"
                                id="column"
                                name="column"
                        >
                            <option value="none">请选择分类..</option>
                            {% for column in columns %}
                                <option value="{{ column.id }}">{{ column }}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="tags">
                            文章标签
                        </label>
                        <input type="text" class="form-control col-3" id="tags" name="tags">
                    </div>
                    <div class="form-group">
                        <label for="summary">
                            文章摘要
                        </label>
                        <textarea type="text" class="form-control" id="summary" name="summary" rows="4">

                        </textarea>

                    </div>
                    <div class="form-group">
                        <label for="body">
                            文章正文
                        </label>
                        <textarea type="text" class="form-control" id="body" name="body" rows="12">

                    </textarea>

                    </div>
                    <button type="submit" class="btn btn-primary">
                        完成
                    </button>
                </form>
            </div>
        </div>
    </div>
{% endblock content %}