From 5116133a52c6064e4cac6d30bbcc449248f6fec8 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Tue, 18 Apr 2023 15:33:25 +0200 Subject: [PATCH] Moved form templates --- .../main/{account_form.html => form/account.html} | 0 .../main/{category_form.html => form/category.html} | 0 .../main/{invoice_form.html => form/invoice.html} | 0 .../main/{snapshot_form.html => form/snapshot.html} | 0 .../{transaction_form.html => form/transaction.html} | 0 nummi/main/views.py | 10 ++++++++++ 6 files changed, 10 insertions(+) rename nummi/main/templates/main/{account_form.html => form/account.html} (100%) rename nummi/main/templates/main/{category_form.html => form/category.html} (100%) rename nummi/main/templates/main/{invoice_form.html => form/invoice.html} (100%) rename nummi/main/templates/main/{snapshot_form.html => form/snapshot.html} (100%) rename nummi/main/templates/main/{transaction_form.html => form/transaction.html} (100%) diff --git a/nummi/main/templates/main/account_form.html b/nummi/main/templates/main/form/account.html similarity index 100% rename from nummi/main/templates/main/account_form.html rename to nummi/main/templates/main/form/account.html diff --git a/nummi/main/templates/main/category_form.html b/nummi/main/templates/main/form/category.html similarity index 100% rename from nummi/main/templates/main/category_form.html rename to nummi/main/templates/main/form/category.html diff --git a/nummi/main/templates/main/invoice_form.html b/nummi/main/templates/main/form/invoice.html similarity index 100% rename from nummi/main/templates/main/invoice_form.html rename to nummi/main/templates/main/form/invoice.html diff --git a/nummi/main/templates/main/snapshot_form.html b/nummi/main/templates/main/form/snapshot.html similarity index 100% rename from nummi/main/templates/main/snapshot_form.html rename to nummi/main/templates/main/form/snapshot.html diff --git a/nummi/main/templates/main/transaction_form.html b/nummi/main/templates/main/form/transaction.html similarity index 100% rename from nummi/main/templates/main/transaction_form.html rename to nummi/main/templates/main/form/transaction.html diff --git a/nummi/main/views.py b/nummi/main/views.py index eacb44d..71a1abb 100644 --- a/nummi/main/views.py +++ b/nummi/main/views.py @@ -114,11 +114,13 @@ class LogoutView(auth_views.LogoutView): class AccountCreateView(NummiCreateView): model = Account form_class = AccountForm + template_name = "main/form/account.html" class TransactionCreateView(NummiCreateView): model = Transaction form_class = TransactionForm + template_name = "main/form/transaction.html" def get_form_kwargs(self): return super().get_form_kwargs() | { @@ -134,6 +136,7 @@ class TransactionCreateView(NummiCreateView): class InvoiceCreateView(NummiCreateView): model = Invoice form_class = InvoiceForm + template_name = "main/form/invoice.html" def form_valid(self, form): form.instance.transaction = get_object_or_404( @@ -149,11 +152,13 @@ class InvoiceCreateView(NummiCreateView): class CategoryCreateView(NummiCreateView): model = Category form_class = CategoryForm + template_name = "main/form/category.html" class SnapshotCreateView(NummiCreateView): model = Snapshot form_class = SnapshotForm + template_name = "main/form/snapshot.html" def get_form_kwargs(self): return super().get_form_kwargs() | { @@ -171,6 +176,7 @@ class SnapshotCreateView(NummiCreateView): class AccountUpdateView(NummiUpdateView): model = Account form_class = AccountForm + template_name = "main/form/account.html" def get_context_data(self, **kwargs): _max = 8 @@ -220,11 +226,13 @@ class AccountUpdateView(NummiUpdateView): class TransactionUpdateView(NummiUpdateView): model = Transaction form_class = TransactionForm + template_name = "main/form/transaction.html" class InvoiceUpdateView(NummiUpdateView): model = Invoice form_class = InvoiceForm + template_name = "main/form/invoice.html" def get_success_url(self): return reverse_lazy("transaction", kwargs={"pk": self.object.transaction.pk}) @@ -244,6 +252,7 @@ class InvoiceUpdateView(NummiUpdateView): class CategoryUpdateView(NummiUpdateView): model = Category form_class = CategoryForm + template_name = "main/form/category.html" def get_context_data(self, **kwargs): data = super().get_context_data(**kwargs) @@ -278,6 +287,7 @@ class CategoryUpdateView(NummiUpdateView): class SnapshotUpdateView(NummiUpdateView): model = Snapshot form_class = SnapshotForm + template_name = "main/form/snapshot.html" def get_context_data(self, **kwargs): data = super().get_context_data(**kwargs)