update.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. <form method="post" action=".">
  12. {% csrf_token %}
  13. <div class="form-group">
  14. <label for="title">
  15. 文章标题
  16. </label>
  17. <input type="text" class="form-control" id="title" name="title" value="{{ article.title }}">
  18. </div>
  19. <div class="form-group">
  20. <label for="column">分类</label>
  21. <select class="form-control"
  22. id="column"
  23. name="column"
  24. >
  25. <option value="none">请选择分类..</option>
  26. {% for column in columns %}
  27. <option value="{{ column.id }}"
  28. {% if column.id == article.column.id %}
  29. selected
  30. {% endif %}
  31. >
  32. {{ column }}
  33. </option>
  34. {% endfor %}
  35. </select>
  36. </div>
  37. <div class="form-group">
  38. <label for="body">
  39. 文章正文
  40. </label>
  41. <textarea type="text" class="form-control" id="body" name="body" rows="12">
  42. {{ article.body }}
  43. </textarea>
  44. </div>
  45. <button type="submit" class="btn btn-primary">
  46. 提交
  47. </button>
  48. </form>
  49. </div>
  50. </div>
  51. </div>
  52. {% endblock content %}