Passage du order_id en primary + vue listing terminée

This commit is contained in:
Michel Roux 2016-02-14 16:55:16 +01:00
parent 7bd025c327
commit e8de4fafc2
3 changed files with 56 additions and 11 deletions

View File

@ -48,4 +48,4 @@ class Command(BaseCommand):
order.save() order.save()
print str(len(orders)) + ' order(s) added!' print str(len(orders)) + ' order(s) processed!'

View File

@ -6,10 +6,9 @@ from django.db import models
class Order(models.Model): class Order(models.Model):
# TODO: Revoir les max_length et null (difficile d'affirmer une limite précise avec le XML) # TODO: Revoir les max_length et null (difficile d'affirmer une limite précise avec le XML)
# TODO: Pas de PRIMARY KEY, du coup, le sync fera des doublons
marketplace = models.CharField(max_length=10) marketplace = models.CharField(max_length=10)
idFlux = models.IntegerField() idFlux = models.IntegerField()
order_id = models.CharField(max_length=20) order_id = models.CharField(max_length=20, primary_key=True)
order_mrid = models.CharField(max_length=20) order_mrid = models.CharField(max_length=20)
order_refid = models.CharField(max_length=20) order_refid = models.CharField(max_length=20)
order_external_id = models.CharField(max_length=20, null=True) order_external_id = models.CharField(max_length=20, null=True)

View File

@ -1,12 +1,58 @@
{% extends 'orders/base.html' %} {% extends 'orders/base.html' %}
{% block title %}List all orders{% endblock %}
{% block body %} {% block body %}
<h1>Orders</h1> <div class="container-fluid">
<ul> <h1>Orders</h1>
{% for order in object_list %}
<li>{{ order.idFlux }}</li> <table class="table table-bordered table-hover">
{% empty %} <thead>
<li>No articles yet.</li> <tr>
{% endfor %} <th></th>
</ul> <th>Order Id</th>
<th>Marketplace</th>
<th>Id Flux</th>
<th>Purchase Date</th>
<th>Amount</th>
<th>Tax</th>
<th>Shipping</th>
<th>Commission</th>
<th>Processing Fee</th>
<th>Comments</th>
<th>Customer Id</th>
<th>Ip</th>
<th>Nb Items</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
{% for order in object_list %}
<tr>
<td></td>
<td>{{ order.order_id }}</td>
<td>{{ order.marketplace }}</td>
<td>{{ order.idFlux }}</td>
<td>{{ order.order_purchase }}</td>
<td>{{ order.order_amount }}</td>
<td>{{ order.order_tax }}</td>
<td>{{ order.order_shipping }}</td>
<td>{{ order.order_commission }}</td>
<td>{{ order.order_processing_fee }}</td>
<td>{{ order.order_comments }}</td>
<td>{{ order.customer_id }}</td>
<td>{{ order.order_ip }}</td>
<td>{{ order.order_items }}</td>
<td></td>
<td></td>
</tr>
{% empty %}
<tr>
<td colspan="16">No orders yet.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %} {% endblock %}