|
|
|
|
@ -41,17 +41,17 @@ |
|
|
|
|
<div class="section section_gray"> |
|
|
|
|
<div class="section__center center center_xs"> |
|
|
|
|
<div class="form"> |
|
|
|
|
<form action="" method="POST"> |
|
|
|
|
<form action="" method="POST" enctype="multipart/form-data"> |
|
|
|
|
{% csrf_token %} |
|
|
|
|
<div class="form__group"> |
|
|
|
|
<div class="form__title">Личные данные</div> |
|
|
|
|
<div class="form__ava ava"> |
|
|
|
|
{% if user.photo %} |
|
|
|
|
<img class="ava__pic" src="{{user.photo.url}}"> |
|
|
|
|
<img id="photo" class="ava__pic" src="{{user.photo.url}}"> |
|
|
|
|
{% else %} |
|
|
|
|
<img class="ava__pic" src="{% static 'img/user.jpg' %}"> |
|
|
|
|
<img id="photo" class="ava__pic" src="{% static 'img/user.jpg' %}"> |
|
|
|
|
{% endif %} |
|
|
|
|
<input class="ava__input" type="file"> |
|
|
|
|
<input name="photo" class="ava__input" type="file" accept='image/*' onchange='openFile(event)'> |
|
|
|
|
<div class="ava__icon"> |
|
|
|
|
<svg class="icon icon-photo"> |
|
|
|
|
<use xlink:href="{% static 'img/sprite.svg' %}#icon-photo"></use> |
|
|
|
|
@ -193,4 +193,17 @@ |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<script> |
|
|
|
|
var openFile = function(file) { |
|
|
|
|
var input = file.target; |
|
|
|
|
|
|
|
|
|
var reader = new FileReader(); |
|
|
|
|
reader.onload = function(){ |
|
|
|
|
var dataURL = reader.result; |
|
|
|
|
var output = document.getElementById('photo'); |
|
|
|
|
output.src = dataURL; |
|
|
|
|
}; |
|
|
|
|
reader.readAsDataURL(input.files[0]); |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
{% endblock content %} |