create.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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=".">
  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="column">分类</label>
  24. <select class="form-control"
  25. id="column"
  26. name="column"
  27. >
  28. <option value="none">请选择分类..</option>
  29. {% for column in columns %}
  30. <option value="{{ column.id }}">{{ column }}</option>
  31. {% endfor %}
  32. </select>
  33. </div>
  34. <div class="form-group">
  35. <label for="tags">
  36. 文章标签
  37. </label>
  38. <input type="text" class="form-control col-3" id="tags" name="tags">
  39. </div>
  40. <div class="form-group">
  41. <label for="body">
  42. 文章正文
  43. </label>
  44. <textarea type="text" class="form-control" id="body" name="body" rows="12">
  45. </textarea>
  46. </div>
  47. <button type="submit" class="btn btn-primary">
  48. 完成
  49. </button>
  50. </form>
  51. </div>
  52. </div>
  53. </div>
  54. {% endblock content %}