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): class AccountCreateView(NummiCreateView):
model = Account model = Account
form_class = AccountForm form_class = AccountForm
template_name = "main/form/account.html"
class TransactionCreateView(NummiCreateView): class TransactionCreateView(NummiCreateView):
model = Transaction model = Transaction
form_class = TransactionForm form_class = TransactionForm
template_name = "main/form/transaction.html"
def get_form_kwargs(self): def get_form_kwargs(self):
return super().get_form_kwargs() | { return super().get_form_kwargs() | {
@ -134,6 +136,7 @@ class TransactionCreateView(NummiCreateView):
class InvoiceCreateView(NummiCreateView): class InvoiceCreateView(NummiCreateView):
model = Invoice model = Invoice
form_class = InvoiceForm form_class = InvoiceForm
template_name = "main/form/invoice.html"
def form_valid(self, form): def form_valid(self, form):
form.instance.transaction = get_object_or_404( form.instance.transaction = get_object_or_404(
@ -149,11 +152,13 @@ class InvoiceCreateView(NummiCreateView):
class CategoryCreateView(NummiCreateView): class CategoryCreateView(NummiCreateView):
model = Category model = Category
form_class = CategoryForm form_class = CategoryForm
template_name = "main/form/category.html"
class SnapshotCreateView(NummiCreateView): class SnapshotCreateView(NummiCreateView):
model = Snapshot model = Snapshot
form_class = SnapshotForm form_class = SnapshotForm
template_name = "main/form/snapshot.html"
def get_form_kwargs(self): def get_form_kwargs(self):
return super().get_form_kwargs() | { return super().get_form_kwargs() | {
@ -171,6 +176,7 @@ class SnapshotCreateView(NummiCreateView):
class AccountUpdateView(NummiUpdateView): class AccountUpdateView(NummiUpdateView):
model = Account model = Account
form_class = AccountForm form_class = AccountForm
template_name = "main/form/account.html"
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
_max = 8 _max = 8
@ -220,11 +226,13 @@ class AccountUpdateView(NummiUpdateView):
class TransactionUpdateView(NummiUpdateView): class TransactionUpdateView(NummiUpdateView):
model = Transaction model = Transaction
form_class = TransactionForm form_class = TransactionForm
template_name = "main/form/transaction.html"
class InvoiceUpdateView(NummiUpdateView): class InvoiceUpdateView(NummiUpdateView):
model = Invoice model = Invoice
form_class = InvoiceForm form_class = InvoiceForm
template_name = "main/form/invoice.html"
def get_success_url(self): def get_success_url(self):
return reverse_lazy("transaction", kwargs={"pk": self.object.transaction.pk}) return reverse_lazy("transaction", kwargs={"pk": self.object.transaction.pk})
@ -244,6 +252,7 @@ class InvoiceUpdateView(NummiUpdateView):
class CategoryUpdateView(NummiUpdateView): class CategoryUpdateView(NummiUpdateView):
model = Category model = Category
form_class = CategoryForm form_class = CategoryForm
template_name = "main/form/category.html"
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
data = super().get_context_data(**kwargs) data = super().get_context_data(**kwargs)
@ -278,6 +287,7 @@ class CategoryUpdateView(NummiUpdateView):
class SnapshotUpdateView(NummiUpdateView): class SnapshotUpdateView(NummiUpdateView):
model = Snapshot model = Snapshot
form_class = SnapshotForm form_class = SnapshotForm
template_name = "main/form/snapshot.html"
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
data = super().get_context_data(**kwargs) data = super().get_context_data(**kwargs)