generated from Code-Institute-Org/gitpod-full-template
/
edit_product.html
66 lines (61 loc) · 1.75 KB
/
edit_product.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{% extends 'base.html' %}
{% load static %}
{% block page_header %}
<div class="container header-container">
<div class="row">
<div class="col"></div>
</div>
</div>
{% endblock %}
{% block content %}
<div class="overlay"></div>
<div class="container">
<div class="row py-3 text-center pt-5">
<div class="col-12">
<span class="icon pt-5">
<i class="fas fa-cart-plus fa-3x py-5 mt-5"></i>
</span>
<h2 class="display-font text-center pt-3">Edit Product</h2>
<p class="text-center body-font mx-5 my-3 px-4">Hi, <strong>{{ user.profile|upper }}! </strong></p>
<hr class="my-2">
</div>
</div>
</div>
<!--edit product container starts here-->
<div class="container">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8 justify-content-center">
<div class="card p-5 my-0 mx-auto bg-main text-light body-font">
<!--edit product form starts here-->
<form method="POST" action="{% url 'edit_product' product.id %}" class="form mb-2" enctype="multipart/form-data">
{% csrf_token %}
{% for field in form %}
{% if field.name != 'image' %}
{{ field | as_crispy_field }}
{% else %}
{% endif %}
{% endfor %}
<div class="text-right">
<button>
<a class="btn btn-dark rounded-0" href="{% url 'shop' %}">Cancel</a>
</button>
<button class="btn btn-dark rounded-0" type="submit">Edit Product</button>
</div>
</form>
<!--./end-edit product-form-->
</div>
<div class="col-md-2"></div>
</div>
</div>
</div>
{% endblock %}
{% block postloadjs %}
{{ block.super }}
<script type="text/javascript">
$('#new-image').change(function () {
var file = $('#new-image')[0].files[0];
$('#filename').text(`Image will be set to: ${file.name}`);
});
</script>
{% endblock %}