edit.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. <div class="col-md-4">
  12. 用户名:{{ user.username }}
  13. </div>
  14. {% if profile.avatar %}
  15. <div class="col-md-4">
  16. 头像
  17. </div>
  18. <img src="{{ profile.avatar.url }}" styl="max-width: 20%; border-radius: 15%;" class="col-md-4">
  19. {% else %}
  20. <h5 class="col-md-4">
  21. 暂无头像
  22. </h5>
  23. {% endif %}
  24. <br>
  25. <br>
  26. <form method="post" action="." enctype="multipart/form-data">
  27. {% csrf_token %}
  28. <div class="form-group">
  29. <label for="avatar">上传头像</label>
  30. <input type="file" class="form-control-file" name="avatar" id="avatar">
  31. </div>
  32. <div class="form-group col-md-4">
  33. <label for="phone">
  34. 电话
  35. </label>
  36. <input type="text" class="form-control" id="phone" name="phone" value="{{ profile.phone }}">
  37. </div>
  38. <div class="form-group col-md-4">
  39. <label for="bio">
  40. 简介
  41. </label>
  42. <textarea type="text" class="form-control" id="bio" name="bio" rows="12">
  43. {{ profile.bio }}
  44. </textarea>
  45. </div>
  46. <button type="submit" class="btn btn-primary">
  47. 提交
  48. </button>
  49. </form>
  50. </div>
  51. </div>
  52. </div>
  53. {% endblock content %}