diff --git a/Lengow/urls.py b/Lengow/urls.py index ae0977f..1bc11f2 100644 --- a/Lengow/urls.py +++ b/Lengow/urls.py @@ -20,5 +20,6 @@ from orders import views urlpatterns = [ url(r'^admin/', admin.site.urls), - url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^$', views.OrderIndexView.as_view(), name='index'), + url(r'^(?P[-\w]+)/$', views.OrderDetailView.as_view(), name='detail'), ] diff --git a/orders/models.py b/orders/models.py index 3fff579..6338614 100644 --- a/orders/models.py +++ b/orders/models.py @@ -6,6 +6,8 @@ from django.db import models class Order(models.Model): # TODO: Revoir les max_length et null (difficile d'affirmer une limite précise avec le XML) + # TODO: Faire des sous-modèles pour gérer de plus d'informations venant du XML comme les adresses, + # le tracking ou le panier marketplace = models.CharField(max_length=10) idFlux = models.IntegerField() order_id = models.CharField(max_length=20, primary_key=True) diff --git a/orders/views.py b/orders/views.py index 9297180..a19cbef 100644 --- a/orders/views.py +++ b/orders/views.py @@ -1,8 +1,13 @@ -from django.views.generic import ListView +from django.views.generic import ListView, DetailView from orders.models import Order -class IndexView(ListView): +class OrderIndexView(ListView): template_name = 'orders/order/index.html' model = Order + + +class OrderDetailView(DetailView): + template_name = 'orders/order/detail.html' + model = Order diff --git a/templates/orders/order/detail.html b/templates/orders/order/detail.html new file mode 100644 index 0000000..1689e59 --- /dev/null +++ b/templates/orders/order/detail.html @@ -0,0 +1,34 @@ +{% extends 'orders/base.html' %} + +{% block title %}Detail for {{ object.order_id }}'s order{% endblock %} + +{% block body %} +
+ +

Order {{ object.order_id }}

+ + + +

+ + Back + +

+
+{% endblock %} diff --git a/templates/orders/order/index.html b/templates/orders/order/index.html index 7374f00..f45a48d 100644 --- a/templates/orders/order/index.html +++ b/templates/orders/order/index.html @@ -9,28 +9,32 @@ - - + + - - + + - + - + - - - + + + {% for order in object_list %} - + @@ -44,8 +48,16 @@ - - + + {% empty %}
Order IdOrder id MarketplaceId FluxPurchase DateId fluxPurchase date Amount Tax Shipping CommissionProcessing FeeProcessing fee CommentsCustomer IdCustomer id IpNb ItemsEditDeleteNb items
+ + + + {{ order.order_id }} {{ order.marketplace }} {{ order.idFlux }}{{ order.customer_id }} {{ order.order_ip }} {{ order.order_items }} + + + + + + + +