{% for item in basket.basketitem_set.all %}
	{% if forloop.first %}
	<form method="POST" action="{% url 'basky:update' %}">
		{% csrf_token %}
		<table>
			<thead>
				<tr>
					<th colspan="2"> Item </th>
					<th> Quantity </th>
					<th> Total </th>
					<th> Remove </th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<th colspan="3">
							{{basket.total_items}}
							item{{basket.total_items|pluralize}}
					</th>
					<th colspan="2">
						{{basket.total}}
					</th>
				</tr>
				<tr>
					<td><button type="submit">Update Basket</button></td>
				</tr>
			</tfoot>
			</tbody>
	{% endif %}
			<tr>
				<td>
					<a href="{item.content_object.get_absolute_url}}">
						<img src="{{item.content_object.img.url}}" width="40" height="40">
					</a>
				</td>
				<td>
				<a href="{{item.content_object.get_absolute_url}}">{{item.description}}</a>
				</td>
				<td>
					<input type="text" name="quantity_{{item.hash}}" value="{{item.quantity}}">
				</td>
				<td>
					{{item.total}}
				</td>
				<td>
					<input type="checkbox" name="remove" value="{{item.pk}}">
				</td>
			</tr>

	{% if forloop.last %}
			</tbody>
		</table>
	</form>
	{% endif %}


	{% empty %}
	<p>
		Your basket is empty.
	</p>

{% endfor %}
