diff --git a/la_chariotte/order/forms.py b/la_chariotte/order/forms.py index 8e28d5a..2cf2817 100644 --- a/la_chariotte/order/forms.py +++ b/la_chariotte/order/forms.py @@ -18,6 +18,10 @@ class GroupedOrderForm(forms.ModelForm): widget=forms.TimeInput(attrs={"type": "time"}), initial=datetime.time(hour=23, minute=59, second=59), ) + is_phone_mandatory = forms.BooleanField( + label="Numéro de téléphone obligatoire pour les participants", + required=False, + ) class Meta: model = GroupedOrder @@ -29,6 +33,7 @@ class GroupedOrderForm(forms.ModelForm): "delivery_slot", "place", "description", + "is_phone_mandatory", ] widgets = { "name": forms.TextInput( diff --git a/la_chariotte/order/migrations/0027_groupedorder_phone_mandatory.py b/la_chariotte/order/migrations/0027_groupedorder_phone_mandatory.py new file mode 100644 index 0000000..b81e9d1 --- /dev/null +++ b/la_chariotte/order/migrations/0027_groupedorder_phone_mandatory.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.11 on 2024-04-14 08:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("order", "0026_groupedorder_delivery_slot"), + ] + + operations = [ + migrations.AddField( + model_name="groupedorder", + name="is_phone_mandatory", + field=models.BooleanField( + default=False, verbose_name="Numéro de téléphone obligatoire" + ), + ), + ] diff --git a/la_chariotte/order/migrations/0028_alter_order_created_date.py b/la_chariotte/order/migrations/0028_alter_order_created_date.py new file mode 100644 index 0000000..e763250 --- /dev/null +++ b/la_chariotte/order/migrations/0028_alter_order_created_date.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2 on 2024-10-20 13:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("order", "0027_groupedorder_phone_mandatory"), + ] + + operations = [ + migrations.AlterField( + model_name="order", + name="created_date", + field=models.DateTimeField( + auto_now_add=True, verbose_name="Date et heure de commande" + ), + ), + ] diff --git a/la_chariotte/order/models.py b/la_chariotte/order/models.py index 55dd867..9b5aeca 100644 --- a/la_chariotte/order/models.py +++ b/la_chariotte/order/models.py @@ -27,6 +27,9 @@ class GroupedOrder(models.Model): description = models.TextField("Description", null=True, blank=True) total_price = models.DecimalField(max_digits=10, decimal_places=2, default=0) code = models.CharField(auto_created=True) + is_phone_mandatory = models.BooleanField( + default=False, verbose_name="Numéro de téléphone obligatoire" + ) def create_code_from_pk(self): """When a grouped order is created, a unique code is generated, to be used to diff --git a/la_chariotte/order/templates/order/grouped_order_create.html b/la_chariotte/order/templates/order/grouped_order_create.html index 3accfb1..01c8858 100644 --- a/la_chariotte/order/templates/order/grouped_order_create.html +++ b/la_chariotte/order/templates/order/grouped_order_create.html @@ -1,5 +1,7 @@ {% extends 'base.html' %} +{% load crispy_forms_tags %} + {% block title %}Nouvelle commande groupée{% endblock %} {% block content %} @@ -10,8 +12,9 @@
Nouvelle commande groupée
-
++