create.html 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {% extends "base.html" %}
  2. {% load static %}
  3. {% block title %}
  4. 发表文章
  5. {% endblock title %}
  6. {% block style %}
  7. <link rel="stylesheet" type="text/css" href="{% static 'L_header.css' %}">
  8. {% endblock style %}
  9. {% block content %}
  10. <div class="container mt-5">
  11. <div class="row">
  12. <div class="col-12">
  13. <br>
  14. <!-- 提交文章的表单 -->
  15. <form method="post" action="." enctype="multipart/form-data">
  16. <!-- Django中需要POST数据的地方都必须有csrf_token -->
  17. {% csrf_token %}
  18. <div class="form-group">
  19. <label for="title">
  20. 文章标题
  21. </label>
  22. <input type="text" class="form-control" id="title" name="title">
  23. </div>
  24. <!--文章标题图-->
  25. <div class="form-group">
  26. <label for="avatar">标题图</label>
  27. <input type="file" class="form-control-file" name="avatar" id="avatar">
  28. </div>
  29. <!--文章类别-->
  30. <div class="form-group">
  31. <label for="column">分类</label>
  32. <select class="form-control"
  33. id="column"
  34. name="column"
  35. >
  36. <option value="none">请选择分类..</option>
  37. {% for column in columns %}
  38. <option value="{{ column.id }}">{{ column }}</option>
  39. {% endfor %}
  40. </select>
  41. </div>
  42. <div class="form-group">
  43. <label for="tags">
  44. 文章标签
  45. </label>
  46. <input type="text" class="form-control col-3" id="tags" name="tags">
  47. </div>
  48. <div class="form-group">
  49. <label for="summary">
  50. 文章摘要
  51. </label>
  52. <textarea type="text" class="form-control" id="summary" name="summary" rows="4">
  53. </textarea>
  54. </div>
  55. <div class="form-group">
  56. <label for="body">
  57. 文章正文
  58. </label>
  59. <textarea type="text" class="form-control" id="body" name="body" rows="12">
  60. </textarea>
  61. </div>
  62. <button type="submit" class="btn btn-primary">
  63. 完成
  64. </button>
  65. </form>
  66. </div>
  67. </div>
  68. </div>
  69. {% endblock content %}