From 5c7bcac49bbb5ed668fe357606fc361c02051d9a Mon Sep 17 00:00:00 2001
From: Laetitia Getti
Date: Mon, 24 Jul 2023 17:48:39 +0200
Subject: [PATCH] add note to grouped order orga
---
.../0023_order_created_date_order_note.py | 28 +++++++++++++++++++
la_chariotte/order/models.py | 2 ++
.../templates/order/grouped_order_detail.html | 2 ++
.../order/grouped_order_overview.html | 25 +++++++++++++----
.../order/templates/order/order_detail.html | 2 +-
la_chariotte/order/tests/test_views.py | 13 +++++++++
la_chariotte/order/views/order.py | 3 +-
7 files changed, 67 insertions(+), 8 deletions(-)
create mode 100644 la_chariotte/order/migrations/0023_order_created_date_order_note.py
diff --git a/la_chariotte/order/migrations/0023_order_created_date_order_note.py b/la_chariotte/order/migrations/0023_order_created_date_order_note.py
new file mode 100644
index 0000000..e218bbc
--- /dev/null
+++ b/la_chariotte/order/migrations/0023_order_created_date_order_note.py
@@ -0,0 +1,28 @@
+# Generated by Django 4.2.1 on 2023-07-24 14:58
+
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("order", "0022_alter_groupedorder_unique_together"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="order",
+ name="created_date",
+ field=models.DateTimeField(
+ auto_now_add=True,
+ default=django.utils.timezone.now,
+ verbose_name="Date de la commande",
+ ),
+ preserve_default=False,
+ ),
+ migrations.AddField(
+ model_name="order",
+ name="note",
+ field=models.TextField(blank=True, max_length=200, null=True),
+ ),
+ ]
diff --git a/la_chariotte/order/models.py b/la_chariotte/order/models.py
index 1335276..4148156 100644
--- a/la_chariotte/order/models.py
+++ b/la_chariotte/order/models.py
@@ -90,6 +90,8 @@ class Order(models.Model):
author = models.ForeignKey(OrderAuthor, on_delete=models.CASCADE)
articles_nb = models.PositiveIntegerField(default=0)
price = models.DecimalField(max_digits=10, decimal_places=2, default=0)
+ created_date = models.DateTimeField("Date de la commande", auto_now_add=True)
+ note = models.TextField(max_length=200, null=True, blank=True)
def compute_order_articles_nb(self):
"""Computes the number of articles in this order"""
diff --git a/la_chariotte/order/templates/order/grouped_order_detail.html b/la_chariotte/order/templates/order/grouped_order_detail.html
index 8683dd4..ff1c7d8 100644
--- a/la_chariotte/order/templates/order/grouped_order_detail.html
+++ b/la_chariotte/order/templates/order/grouped_order_detail.html
@@ -134,6 +134,8 @@
+
+