create.html 2.4 KB

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