Moved form templates

This commit is contained in:
Edgar P. Burkhart 2023-04-18 15:33:25 +02:00
parent c210e91fff
commit 5116133a52
Signed by: edpibu
GPG Key ID: 9833D3C5A25BD227
6 changed files with 10 additions and 0 deletions

View File

@ -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)