diff --git a/la_chariotte/accounts/apps.py b/la_chariotte/accounts/apps.py deleted file mode 100644 index 299b83e..0000000 --- a/la_chariotte/accounts/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class AccountsConfig(AppConfig): - default_auto_field = "django.db.models.BigAutoField" - name = "la_chariotte.accounts" diff --git a/la_chariotte/accounts/forms.py b/la_chariotte/accounts/forms.py deleted file mode 100644 index b6466c9..0000000 --- a/la_chariotte/accounts/forms.py +++ /dev/null @@ -1,37 +0,0 @@ -from crispy_bulma.layout import Submit -from crispy_forms.helper import FormHelper -from crispy_forms.layout import Layout -from django import forms -from django.contrib.auth.forms import UserChangeForm, UserCreationForm - -from .models import CustomUser - - -class CustomUserCreationForm(UserCreationForm): - class Meta: - model = CustomUser - fields = ("username", "first_name", "last_name", "password1", "password2") - widgets = { - "username": forms.TextInput( - attrs={ - "placeholder": "exemple@mail.fr", - } - ), - } - - helper = FormHelper() - helper.form_class = "form-horizontal" - helper.layout = Layout( - "username", - "first_name", - "last_name", - "password1", - "password2", - Submit("submit", "Valider", css_class="is-primary"), - ) - - -class CustomUserChangeForm(UserChangeForm): # pas encore utilisé - pour la V1 - class Meta: - model = CustomUser - fields = ("email", "first_name", "last_name") diff --git a/la_chariotte/accounts/models.py b/la_chariotte/accounts/models.py deleted file mode 100644 index a953c3b..0000000 --- a/la_chariotte/accounts/models.py +++ /dev/null @@ -1,17 +0,0 @@ -from django.contrib.auth.models import AbstractUser -from django.db import models - - -class CustomUser(AbstractUser): - EMAIL_FIELD = "username" - - username = models.EmailField( - "Email", - unique=True, - error_messages={ - "unique": "Un·e utilisateur·ice avec cette adresse mail existe déjà.", - }, - ) - - def __str__(self): - return self.get_full_name() diff --git a/la_chariotte/accounts/urls.py b/la_chariotte/accounts/urls.py deleted file mode 100644 index fb9874d..0000000 --- a/la_chariotte/accounts/urls.py +++ /dev/null @@ -1,10 +0,0 @@ -from django.urls import include, path -from django.views.generic import TemplateView - -from . import views - -app_name = "accounts" -urlpatterns = [ - path("inscription/", views.SignUpView.as_view(), name="signup"), - path("", include("django.contrib.auth.urls")), -] diff --git a/la_chariotte/accounts/admin.py b/la_chariotte/admin.py similarity index 61% rename from la_chariotte/accounts/admin.py rename to la_chariotte/admin.py index 3cd90ef..22555f3 100644 --- a/la_chariotte/accounts/admin.py +++ b/la_chariotte/admin.py @@ -2,7 +2,7 @@ from django.contrib import admin from django.contrib.auth.admin import UserAdmin from .forms import CustomUserChangeForm, CustomUserCreationForm -from .models import CustomUser +from .models import CustomUser, GroupedOrder, Item, Order, OrderAuthor, OrderedItem class CustomUserAdmin(UserAdmin): @@ -13,3 +13,10 @@ class CustomUserAdmin(UserAdmin): admin.site.register(CustomUser, CustomUserAdmin) + + +admin.site.register(GroupedOrder) +admin.site.register(Order) +admin.site.register(Item) +admin.site.register(OrderedItem) +admin.site.register(OrderAuthor) diff --git a/la_chariotte/apps.py b/la_chariotte/apps.py new file mode 100644 index 0000000..3181adc --- /dev/null +++ b/la_chariotte/apps.py @@ -0,0 +1,16 @@ +from django.apps import AppConfig + + +class AccountsConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "la_chariotte.accounts" + + +class MailConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "la_chariotte.mail" + + +class OrderConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "la_chariotte.order" diff --git a/la_chariotte/order/forms.py b/la_chariotte/forms.py similarity index 76% rename from la_chariotte/order/forms.py rename to la_chariotte/forms.py index 8e28d5a..5a83d01 100644 --- a/la_chariotte/order/forms.py +++ b/la_chariotte/forms.py @@ -1,12 +1,48 @@ import datetime +from crispy_bulma.layout import Submit +from crispy_forms.helper import FormHelper +from crispy_forms.layout import Layout from django import forms from django.contrib.auth import get_user_model +from django.contrib.auth.forms import UserChangeForm, UserCreationForm from django.forms.utils import to_current_timezone from django.utils import timezone from la_chariotte.order.models import GroupedOrder, Item +from .models import CustomUser + + +class CustomUserCreationForm(UserCreationForm): + class Meta: + model = CustomUser + fields = ("username", "first_name", "last_name", "password1", "password2") + widgets = { + "username": forms.TextInput( + attrs={ + "placeholder": "exemple@mail.fr", + } + ), + } + + helper = FormHelper() + helper.form_class = "form-horizontal" + helper.layout = Layout( + "username", + "first_name", + "last_name", + "password1", + "password2", + Submit("submit", "Valider", css_class="is-primary"), + ) + + +class CustomUserChangeForm(UserChangeForm): # pas encore utilisé - pour la V1 + class Meta: + model = CustomUser + fields = ("email", "first_name", "last_name") + class GroupedOrderForm(forms.ModelForm): deadline_date = forms.DateField( diff --git a/la_chariotte/mail/apps.py b/la_chariotte/mail/apps.py deleted file mode 100644 index 6230dde..0000000 --- a/la_chariotte/mail/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class MailConfig(AppConfig): - default_auto_field = "django.db.models.BigAutoField" - name = "la_chariotte.mail" diff --git a/la_chariotte/accounts/migrations/0001_initial.py b/la_chariotte/migrations/accounts/0001_initial.py similarity index 100% rename from la_chariotte/accounts/migrations/0001_initial.py rename to la_chariotte/migrations/accounts/0001_initial.py diff --git a/la_chariotte/accounts/migrations/0002_alter_customuser_email_alter_customuser_username.py b/la_chariotte/migrations/accounts/0002_alter_customuser_email_alter_customuser_username.py similarity index 100% rename from la_chariotte/accounts/migrations/0002_alter_customuser_email_alter_customuser_username.py rename to la_chariotte/migrations/accounts/0002_alter_customuser_email_alter_customuser_username.py diff --git a/la_chariotte/accounts/__init__.py b/la_chariotte/migrations/accounts/__init__.py similarity index 100% rename from la_chariotte/accounts/__init__.py rename to la_chariotte/migrations/accounts/__init__.py diff --git a/la_chariotte/order/migrations/0001_initial.py b/la_chariotte/migrations/order/0001_initial.py similarity index 100% rename from la_chariotte/order/migrations/0001_initial.py rename to la_chariotte/migrations/order/0001_initial.py diff --git a/la_chariotte/order/migrations/0002_grouped_order_name.py b/la_chariotte/migrations/order/0002_grouped_order_name.py similarity index 100% rename from la_chariotte/order/migrations/0002_grouped_order_name.py rename to la_chariotte/migrations/order/0002_grouped_order_name.py diff --git a/la_chariotte/order/migrations/0003_item.py b/la_chariotte/migrations/order/0003_item.py similarity index 100% rename from la_chariotte/order/migrations/0003_item.py rename to la_chariotte/migrations/order/0003_item.py diff --git a/la_chariotte/order/migrations/0004_item_ordered_nb.py b/la_chariotte/migrations/order/0004_item_ordered_nb.py similarity index 100% rename from la_chariotte/order/migrations/0004_item_ordered_nb.py rename to la_chariotte/migrations/order/0004_item_ordered_nb.py diff --git a/la_chariotte/order/migrations/0005_remove_item_ordered_nb_alter_order_grouped_order_and_more.py b/la_chariotte/migrations/order/0005_remove_item_ordered_nb_alter_order_grouped_order_and_more.py similarity index 100% rename from la_chariotte/order/migrations/0005_remove_item_ordered_nb_alter_order_grouped_order_and_more.py rename to la_chariotte/migrations/order/0005_remove_item_ordered_nb_alter_order_grouped_order_and_more.py diff --git a/la_chariotte/order/migrations/0006_item_ordered_nb.py b/la_chariotte/migrations/order/0006_item_ordered_nb.py similarity index 100% rename from la_chariotte/order/migrations/0006_item_ordered_nb.py rename to la_chariotte/migrations/order/0006_item_ordered_nb.py diff --git a/la_chariotte/order/migrations/0007_alter_ordereditem_item_alter_ordereditem_order.py b/la_chariotte/migrations/order/0007_alter_ordereditem_item_alter_ordereditem_order.py similarity index 100% rename from la_chariotte/order/migrations/0007_alter_ordereditem_item_alter_ordereditem_order.py rename to la_chariotte/migrations/order/0007_alter_ordereditem_item_alter_ordereditem_order.py diff --git a/la_chariotte/order/migrations/0008_grouped_order_deadline.py b/la_chariotte/migrations/order/0008_grouped_order_deadline.py similarity index 100% rename from la_chariotte/order/migrations/0008_grouped_order_deadline.py rename to la_chariotte/migrations/order/0008_grouped_order_deadline.py diff --git a/la_chariotte/order/migrations/0009_rename_date_grouped_order_delivery_date.py b/la_chariotte/migrations/order/0009_rename_date_grouped_order_delivery_date.py similarity index 100% rename from la_chariotte/order/migrations/0009_rename_date_grouped_order_delivery_date.py rename to la_chariotte/migrations/order/0009_rename_date_grouped_order_delivery_date.py diff --git a/la_chariotte/order/migrations/0010_rename_grouped_order_groupedorder.py b/la_chariotte/migrations/order/0010_rename_grouped_order_groupedorder.py similarity index 100% rename from la_chariotte/order/migrations/0010_rename_grouped_order_groupedorder.py rename to la_chariotte/migrations/order/0010_rename_grouped_order_groupedorder.py diff --git a/la_chariotte/order/migrations/0011_alter_groupedorder_orga.py b/la_chariotte/migrations/order/0011_alter_groupedorder_orga.py similarity index 100% rename from la_chariotte/order/migrations/0011_alter_groupedorder_orga.py rename to la_chariotte/migrations/order/0011_alter_groupedorder_orga.py diff --git a/la_chariotte/order/migrations/0012_alter_groupedorder_name_alter_groupedorder_orga.py b/la_chariotte/migrations/order/0012_alter_groupedorder_name_alter_groupedorder_orga.py similarity index 100% rename from la_chariotte/order/migrations/0012_alter_groupedorder_name_alter_groupedorder_orga.py rename to la_chariotte/migrations/order/0012_alter_groupedorder_name_alter_groupedorder_orga.py diff --git a/la_chariotte/order/migrations/0013_alter_groupedorder_unique_together.py b/la_chariotte/migrations/order/0013_alter_groupedorder_unique_together.py similarity index 100% rename from la_chariotte/order/migrations/0013_alter_groupedorder_unique_together.py rename to la_chariotte/migrations/order/0013_alter_groupedorder_unique_together.py diff --git a/la_chariotte/order/migrations/0014_item_max_limit_item_price.py b/la_chariotte/migrations/order/0014_item_max_limit_item_price.py similarity index 100% rename from la_chariotte/order/migrations/0014_item_max_limit_item_price.py rename to la_chariotte/migrations/order/0014_item_max_limit_item_price.py diff --git a/la_chariotte/order/migrations/0015_groupedorder_description_groupedorder_place.py b/la_chariotte/migrations/order/0015_groupedorder_description_groupedorder_place.py similarity index 100% rename from la_chariotte/order/migrations/0015_groupedorder_description_groupedorder_place.py rename to la_chariotte/migrations/order/0015_groupedorder_description_groupedorder_place.py diff --git a/la_chariotte/order/migrations/0016_alter_groupedorder_description.py b/la_chariotte/migrations/order/0016_alter_groupedorder_description.py similarity index 100% rename from la_chariotte/order/migrations/0016_alter_groupedorder_description.py rename to la_chariotte/migrations/order/0016_alter_groupedorder_description.py diff --git a/la_chariotte/order/migrations/0017_orderauthor_alter_order_author.py b/la_chariotte/migrations/order/0017_orderauthor_alter_order_author.py similarity index 100% rename from la_chariotte/order/migrations/0017_orderauthor_alter_order_author.py rename to la_chariotte/migrations/order/0017_orderauthor_alter_order_author.py diff --git a/la_chariotte/order/migrations/0018_order_articles_nb.py b/la_chariotte/migrations/order/0018_order_articles_nb.py similarity index 100% rename from la_chariotte/order/migrations/0018_order_articles_nb.py rename to la_chariotte/migrations/order/0018_order_articles_nb.py diff --git a/la_chariotte/order/migrations/0019_order_price.py b/la_chariotte/migrations/order/0019_order_price.py similarity index 100% rename from la_chariotte/order/migrations/0019_order_price.py rename to la_chariotte/migrations/order/0019_order_price.py diff --git a/la_chariotte/order/migrations/0020_groupedorder_total_price_alter_orderauthor_email.py b/la_chariotte/migrations/order/0020_groupedorder_total_price_alter_orderauthor_email.py similarity index 100% rename from la_chariotte/order/migrations/0020_groupedorder_total_price_alter_orderauthor_email.py rename to la_chariotte/migrations/order/0020_groupedorder_total_price_alter_orderauthor_email.py diff --git a/la_chariotte/order/migrations/0021_alter_orderauthor_email_alter_orderauthor_phone.py b/la_chariotte/migrations/order/0021_alter_orderauthor_email_alter_orderauthor_phone.py similarity index 100% rename from la_chariotte/order/migrations/0021_alter_orderauthor_email_alter_orderauthor_phone.py rename to la_chariotte/migrations/order/0021_alter_orderauthor_email_alter_orderauthor_phone.py diff --git a/la_chariotte/order/migrations/0022_alter_groupedorder_unique_together.py b/la_chariotte/migrations/order/0022_alter_groupedorder_unique_together.py similarity index 100% rename from la_chariotte/order/migrations/0022_alter_groupedorder_unique_together.py rename to la_chariotte/migrations/order/0022_alter_groupedorder_unique_together.py diff --git a/la_chariotte/order/migrations/0023_order_created_date_order_note.py b/la_chariotte/migrations/order/0023_order_created_date_order_note.py similarity index 100% rename from la_chariotte/order/migrations/0023_order_created_date_order_note.py rename to la_chariotte/migrations/order/0023_order_created_date_order_note.py diff --git a/la_chariotte/order/migrations/0024_alter_item_options.py b/la_chariotte/migrations/order/0024_alter_item_options.py similarity index 100% rename from la_chariotte/order/migrations/0024_alter_item_options.py rename to la_chariotte/migrations/order/0024_alter_item_options.py diff --git a/la_chariotte/order/migrations/0025_groupedorder_code.py b/la_chariotte/migrations/order/0025_groupedorder_code.py similarity index 100% rename from la_chariotte/order/migrations/0025_groupedorder_code.py rename to la_chariotte/migrations/order/0025_groupedorder_code.py diff --git a/la_chariotte/order/migrations/0026_groupedorder_delivery_slot.py b/la_chariotte/migrations/order/0026_groupedorder_delivery_slot.py similarity index 100% rename from la_chariotte/order/migrations/0026_groupedorder_delivery_slot.py rename to la_chariotte/migrations/order/0026_groupedorder_delivery_slot.py diff --git a/la_chariotte/accounts/migrations/__init__.py b/la_chariotte/migrations/order/__init__.py similarity index 100% rename from la_chariotte/accounts/migrations/__init__.py rename to la_chariotte/migrations/order/__init__.py diff --git a/la_chariotte/order/models.py b/la_chariotte/models.py similarity index 95% rename from la_chariotte/order/models.py rename to la_chariotte/models.py index 2733fa9..7e86849 100644 --- a/la_chariotte/order/models.py +++ b/la_chariotte/models.py @@ -1,6 +1,7 @@ import random import base36 +from django.contrib.auth.models import AbstractUser from django.core.exceptions import ValidationError from django.db import models from django.urls import reverse @@ -9,6 +10,21 @@ from django.utils import timezone from la_chariotte.settings import AUTH_USER_MODEL +class CustomUser(AbstractUser): + EMAIL_FIELD = "username" + + username = models.EmailField( + "Email", + unique=True, + error_messages={ + "unique": "Un·e utilisateur·ice avec cette adresse mail existe déjà.", + }, + ) + + def __str__(self): + return self.get_full_name() + + class GroupedOrder(models.Model): name = models.CharField( max_length=100, null=True, verbose_name="Titre de la commande" diff --git a/la_chariotte/order/__init__.py b/la_chariotte/order/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/la_chariotte/order/admin.py b/la_chariotte/order/admin.py deleted file mode 100644 index 8182731..0000000 --- a/la_chariotte/order/admin.py +++ /dev/null @@ -1,9 +0,0 @@ -from django.contrib import admin - -from .models import GroupedOrder, Item, Order, OrderAuthor, OrderedItem - -admin.site.register(GroupedOrder) -admin.site.register(Order) -admin.site.register(Item) -admin.site.register(OrderedItem) -admin.site.register(OrderAuthor) diff --git a/la_chariotte/order/apps.py b/la_chariotte/order/apps.py deleted file mode 100644 index 337993a..0000000 --- a/la_chariotte/order/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class OrderConfig(AppConfig): - default_auto_field = "django.db.models.BigAutoField" - name = "la_chariotte.order" diff --git a/la_chariotte/order/migrations/__init__.py b/la_chariotte/order/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/la_chariotte/order/urls.py b/la_chariotte/order/urls.py deleted file mode 100644 index e49629d..0000000 --- a/la_chariotte/order/urls.py +++ /dev/null @@ -1,80 +0,0 @@ -from django.urls import path - -from . import views - -app_name = "order" -urlpatterns = [ - path("", views.IndexView.as_view(), name="index"), - path( - "/", - views.GroupedOrderDetailView.as_view(), - name="grouped_order_detail", - ), - path( - "/ics/", - views.GroupedOrderEventView.as_view(), - name="grouped_order_event", - ), - path( - "/gerer", - views.GroupedOrderOverview.as_view(), - name="grouped_order_overview", - ), - path("/commander/", views.place_order, name="order"), - path( - "//confirmation/", - views.OrderDetailView.as_view(), - name="order_confirm", - ), - path( - "/gerer//supprimer", - views.OrderDeleteView.as_view(), - name="order_delete", - ), - path("creer", views.GroupedOrderCreateView.as_view(), name="create_grouped_order"), - path( - "/gerer-produits", - views.GroupedOrderAddItemsView.as_view(), - name="manage_items", - ), - path( - "/modifier", - views.GroupedOrderUpdateView.as_view(), - name="update_grouped_order", - ), - path( - "/supprimer", - views.GroupedOrderDeleteView.as_view(), - name="delete_grouped_order", - ), - path( - "/dupliquer", - views.GroupedOrderDuplicateView.as_view(), - name="duplicate_grouped_order", - ), - path( - "/gerer-produits/nouveau", - views.ItemCreateView.as_view(), - name="item_create", - ), - path( - "/gerer-produits//supprimer", - views.ItemDeleteView.as_view(), - name="item_delete", - ), - path( - "/gerer/imprimer", - views.DownloadGroupedOrderSheetView.as_view(), - name="grouped_order_sheet", - ), - path( - "/gerer/liste-mails", - views.ExportGroupOrderEmailAdressesToDownloadView.as_view(), - name="email_list", - ), - path( - "/gerer/csv", - views.ExportGroupedOrderToCSVView.as_view(), - name="grouped_order_csv_export", - ), -] diff --git a/la_chariotte/mail/templates/mail/base_mail.html b/la_chariotte/templates/mail/base_mail.html similarity index 100% rename from la_chariotte/mail/templates/mail/base_mail.html rename to la_chariotte/templates/mail/base_mail.html diff --git a/la_chariotte/mail/templates/mail/order_confirm_mail.html b/la_chariotte/templates/mail/order_confirm_mail.html similarity index 100% rename from la_chariotte/mail/templates/mail/order_confirm_mail.html rename to la_chariotte/templates/mail/order_confirm_mail.html diff --git a/la_chariotte/order/templates/order/grouped_order_add_items.html b/la_chariotte/templates/order/grouped_order_add_items.html similarity index 100% rename from la_chariotte/order/templates/order/grouped_order_add_items.html rename to la_chariotte/templates/order/grouped_order_add_items.html diff --git a/la_chariotte/order/templates/order/grouped_order_confirm_delete.html b/la_chariotte/templates/order/grouped_order_confirm_delete.html similarity index 100% rename from la_chariotte/order/templates/order/grouped_order_confirm_delete.html rename to la_chariotte/templates/order/grouped_order_confirm_delete.html diff --git a/la_chariotte/order/templates/order/grouped_order_create.html b/la_chariotte/templates/order/grouped_order_create.html similarity index 100% rename from la_chariotte/order/templates/order/grouped_order_create.html rename to la_chariotte/templates/order/grouped_order_create.html diff --git a/la_chariotte/order/templates/order/grouped_order_detail.html b/la_chariotte/templates/order/grouped_order_detail.html similarity index 100% rename from la_chariotte/order/templates/order/grouped_order_detail.html rename to la_chariotte/templates/order/grouped_order_detail.html diff --git a/la_chariotte/order/templates/order/grouped_order_overview.html b/la_chariotte/templates/order/grouped_order_overview.html similarity index 100% rename from la_chariotte/order/templates/order/grouped_order_overview.html rename to la_chariotte/templates/order/grouped_order_overview.html diff --git a/la_chariotte/order/templates/order/grouped_order_sheet.html b/la_chariotte/templates/order/grouped_order_sheet.html similarity index 100% rename from la_chariotte/order/templates/order/grouped_order_sheet.html rename to la_chariotte/templates/order/grouped_order_sheet.html diff --git a/la_chariotte/order/templates/order/grouped_order_update.html b/la_chariotte/templates/order/grouped_order_update.html similarity index 100% rename from la_chariotte/order/templates/order/grouped_order_update.html rename to la_chariotte/templates/order/grouped_order_update.html diff --git a/la_chariotte/order/templates/order/index.html b/la_chariotte/templates/order/index.html similarity index 100% rename from la_chariotte/order/templates/order/index.html rename to la_chariotte/templates/order/index.html diff --git a/la_chariotte/order/templates/order/order_detail.html b/la_chariotte/templates/order/order_detail.html similarity index 100% rename from la_chariotte/order/templates/order/order_detail.html rename to la_chariotte/templates/order/order_detail.html diff --git a/la_chariotte/accounts/templates/registration/login.html b/la_chariotte/templates/registration/login.html similarity index 100% rename from la_chariotte/accounts/templates/registration/login.html rename to la_chariotte/templates/registration/login.html diff --git a/la_chariotte/accounts/templates/registration/password_reset_complete.html b/la_chariotte/templates/registration/password_reset_complete.html similarity index 100% rename from la_chariotte/accounts/templates/registration/password_reset_complete.html rename to la_chariotte/templates/registration/password_reset_complete.html diff --git a/la_chariotte/accounts/templates/registration/password_reset_confirm.html b/la_chariotte/templates/registration/password_reset_confirm.html similarity index 100% rename from la_chariotte/accounts/templates/registration/password_reset_confirm.html rename to la_chariotte/templates/registration/password_reset_confirm.html diff --git a/la_chariotte/accounts/templates/registration/password_reset_done.html b/la_chariotte/templates/registration/password_reset_done.html similarity index 100% rename from la_chariotte/accounts/templates/registration/password_reset_done.html rename to la_chariotte/templates/registration/password_reset_done.html diff --git a/la_chariotte/accounts/templates/registration/password_reset_form.html b/la_chariotte/templates/registration/password_reset_form.html similarity index 100% rename from la_chariotte/accounts/templates/registration/password_reset_form.html rename to la_chariotte/templates/registration/password_reset_form.html diff --git a/la_chariotte/accounts/templates/registration/signup.html b/la_chariotte/templates/registration/signup.html similarity index 100% rename from la_chariotte/accounts/templates/registration/signup.html rename to la_chariotte/templates/registration/signup.html diff --git a/la_chariotte/order/templates/warning_grouped_order_creation.html b/la_chariotte/templates/warning_grouped_order_creation.js similarity index 100% rename from la_chariotte/order/templates/warning_grouped_order_creation.html rename to la_chariotte/templates/warning_grouped_order_creation.js diff --git a/la_chariotte/order/templatetags/settings.py b/la_chariotte/templatetags/settings.py similarity index 100% rename from la_chariotte/order/templatetags/settings.py rename to la_chariotte/templatetags/settings.py diff --git a/la_chariotte/urls.py b/la_chariotte/urls.py index 611bcc4..583c135 100644 --- a/la_chariotte/urls.py +++ b/la_chariotte/urls.py @@ -1,17 +1,4 @@ """la_chariotte URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/4.1/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin @@ -25,11 +12,94 @@ from django.views.generic.base import TemplateView from la_chariotte import settings from la_chariotte.order.views import JoinGroupedOrderView +from la_chariotte.views import accounts, orders urlpatterns = [ path("admin/", admin.site.urls), - path("commande/", include("la_chariotte.order.urls")), - path("comptes/", include("la_chariotte.accounts.urls")), + path( + "commande/", + [ + path("", orders.IndexView.as_view(), name="index"), + path( + "/", + orders.GroupedOrderDetailView.as_view(), + name="grouped_order_detail", + ), + path( + "/ics/", + orders.GroupedOrderEventView.as_view(), + name="grouped_order_event", + ), + path( + "/gerer", + orders.GroupedOrderOverview.as_view(), + name="grouped_order_overview", + ), + path("/commander/", orders.place_order, name="order"), + path( + "//confirmation/", + orders.OrderDetailView.as_view(), + name="order_confirm", + ), + path( + "/gerer//supprimer", + orders.OrderDeleteView.as_view(), + name="order_delete", + ), + path( + "creer", + orders.GroupedOrderCreateView.as_view(), + name="create_grouped_order", + ), + path( + "/gerer-produits", + orders.GroupedOrderAddItemsView.as_view(), + name="manage_items", + ), + path( + "/modifier", + orders.GroupedOrderUpdateView.as_view(), + name="update_grouped_order", + ), + path( + "/supprimer", + orders.GroupedOrderDeleteView.as_view(), + name="delete_grouped_order", + ), + path( + "/dupliquer", + orders.GroupedOrderDuplicateView.as_view(), + name="duplicate_grouped_order", + ), + path( + "/gerer-produits/nouveau", + orders.ItemCreateView.as_view(), + name="item_create", + ), + path( + "/gerer-produits//supprimer", + orders.ItemDeleteView.as_view(), + name="item_delete", + ), + path( + "/gerer/imprimer", + orders.DownloadGroupedordersheetView.as_view(), + name="grouped_order_sheet", + ), + path( + "/gerer/liste-mails", + orders.ExportGroupOrderEmailAdressesToDownloadView.as_view(), + name="email_list", + ), + path( + "/gerer/csv", + orders.ExportGroupedOrderToCSVView.as_view(), + name="grouped_order_csv_export", + ), + ], + ), + path("comptes/", include("django.contrib.auth.urls")), + path("comptes/inscription/", accounts.SignUpView.as_view(), name="signup"), # Some paths for accounts are easier to leave here # - PasswordResetView sends the mail # - PasswordResetDoneView shows a success message for the above diff --git a/la_chariotte/mail/utils.py b/la_chariotte/utils.py similarity index 100% rename from la_chariotte/mail/utils.py rename to la_chariotte/utils.py diff --git a/la_chariotte/mail/__init__.py b/la_chariotte/views/__init__.py similarity index 100% rename from la_chariotte/mail/__init__.py rename to la_chariotte/views/__init__.py diff --git a/la_chariotte/accounts/views.py b/la_chariotte/views/accounts.py similarity index 100% rename from la_chariotte/accounts/views.py rename to la_chariotte/views/accounts.py diff --git a/la_chariotte/order/views/__init__.py b/la_chariotte/views/orders/__init__.py similarity index 100% rename from la_chariotte/order/views/__init__.py rename to la_chariotte/views/orders/__init__.py diff --git a/la_chariotte/order/views/grouped_order.py b/la_chariotte/views/orders/grouped_order.py similarity index 100% rename from la_chariotte/order/views/grouped_order.py rename to la_chariotte/views/orders/grouped_order.py diff --git a/la_chariotte/order/views/item.py b/la_chariotte/views/orders/item.py similarity index 100% rename from la_chariotte/order/views/item.py rename to la_chariotte/views/orders/item.py diff --git a/la_chariotte/order/views/order.py b/la_chariotte/views/orders/order.py similarity index 100% rename from la_chariotte/order/views/order.py rename to la_chariotte/views/orders/order.py