add comment to orders
This commit is contained in:
parent
741ae97c91
commit
a691a0d0b4
20
shop/migrations/0032_order_customer_comment.py
Normal file
20
shop/migrations/0032_order_customer_comment.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.3 on 2016-11-09 11:46
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('shop', '0031_auto_20161109_1000'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='order',
|
||||
name='customer_comment',
|
||||
field=models.TextField(default=b'', help_text='If you have any comments about the order please enter them here.', verbose_name='Customer comment'),
|
||||
),
|
||||
]
|
|
@ -117,6 +117,13 @@ class Order(CreatedUpdatedModel):
|
|||
default=False,
|
||||
)
|
||||
|
||||
customer_comment = models.TextField(
|
||||
verbose_name=_('Customer comment'),
|
||||
help_text=_('If you have any comments about the order please enter them here.'),
|
||||
default='',
|
||||
)
|
||||
|
||||
|
||||
objects = OrderQuerySet.as_manager()
|
||||
|
||||
def __unicode__(self):
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
name="{{ order_product.id }}"
|
||||
value="{{ order_product.quantity }}" />
|
||||
{% bootstrap_button '<i class="glyphicon glyphicon-remove"></i>' button_type="submit" button_class="btn-danger" name="remove_product" value=order_product.pk %}
|
||||
</form>
|
||||
{% else %}
|
||||
{{ order_product.quantity }}
|
||||
{% endif %}
|
||||
|
@ -65,6 +64,9 @@
|
|||
|
||||
</table>
|
||||
|
||||
<h3>Comment:</h3>
|
||||
<input type="text" class="form-control" name="customer_comment" style="width: 100%;" placeholder="If you have any comments for this order please enter them here..." value="{{ order.customer_comment }}" {% if order.open == None %}readonly{% endif %}></p>
|
||||
|
||||
{% if not order.open == None %}
|
||||
{% bootstrap_button "Update order" button_type="submit" button_class="btn-primary" name="update_order" %}
|
||||
{% endif %}
|
||||
|
|
|
@ -299,6 +299,7 @@ class OrderDetailView(
|
|||
# Set payment method and mark the order as closed
|
||||
order.payment_method = payment_method
|
||||
order.open = None
|
||||
order.customer_comment = request.POST.get('customer_comment')
|
||||
order.save()
|
||||
|
||||
reverses = {
|
||||
|
@ -329,6 +330,8 @@ class OrderDetailView(
|
|||
new_quantity = int(request.POST.get(order_product_id))
|
||||
order_product.quantity = new_quantity
|
||||
order_product.save()
|
||||
order.customer_comment = request.POST.get('customer_comment')
|
||||
order.save()
|
||||
|
||||
product_remove = request.POST.get('remove_product')
|
||||
if product_remove:
|
||||
|
|
Loading…
Reference in a new issue