From 66cc4cd0089ef69be2cb9bf4e3616f3328e09552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xe=CC=81fir=20Destiny?= Date: Sun, 14 Feb 2016 17:27:22 +0100 Subject: [PATCH] On a fini le requis, allons dans l'optionnel --- Lengow/urls.py | 3 ++- orders/models.py | 2 ++ orders/views.py | 9 ++++++-- templates/orders/order/detail.html | 34 ++++++++++++++++++++++++++++ templates/orders/order/index.html | 36 ++++++++++++++++++++---------- 5 files changed, 69 insertions(+), 15 deletions(-) create mode 100644 templates/orders/order/detail.html 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 }}

+ +
    +
  • Marketplace : {{ object.marketplace }}
  • +
  • Id flux : {{ object.idFlux }}
  • +
  • Mr id : {{ object.order_mrid }}
  • +
  • Reference id : {{ object.order_refid }}
  • +
  • External id : {{ object.order_external_id }}
  • +
  • Purchase date : {{ object.order_purchase }}
  • +
  • Amount : {{ object.order_amount }}
  • +
  • Tax : {{ object.order_tax }}
  • +
  • Shipping : {{ object.order_shipping }}
  • +
  • Commission : {{ object.order_commission }}
  • +
  • Processing fee : {{ object.order_processing_fee }}
  • +
  • Comments : {{ object.order_comments }}
  • +
  • Customer id : {{ object.customer_id }}
  • +
  • Ip : {{ object.order_ip }}
  • +
  • Number of items : {{ object.order_items }}
  • +
+ +

+ + 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 }} + + + + + + + +