add done page for bill created
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import apps, views
|
||||
from .views import BillCreateView, BillListView, BillUpdateView
|
||||
from .views import BillCreateView, BillCreateDoneView, BillListView, BillUpdateView
|
||||
|
||||
app_name = apps.FinanceConfig.name
|
||||
|
||||
@@ -9,4 +9,9 @@ urlpatterns = [
|
||||
path("", BillListView.as_view(), name="bill_list"),
|
||||
path("<int:pk>/", BillUpdateView.as_view(), name="bill_update"),
|
||||
path("create-bill/", BillCreateView.as_view(), name="bill_create"),
|
||||
path(
|
||||
"create-bill/<int:pk>/done/",
|
||||
BillCreateDoneView.as_view(),
|
||||
name="bill_create_done",
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
|
||||
from django.contrib.auth.models import User
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic import ListView
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.views.generic import ListView, TemplateView
|
||||
from django.views.generic.detail import DetailView
|
||||
from django.views.generic.edit import CreateView, UpdateView
|
||||
|
||||
@@ -16,7 +16,6 @@ from .models import BankData, Bill, Resolution
|
||||
class BillCreateView(LoginRequiredMixin, CreateView):
|
||||
form_class = BillCreateForm
|
||||
model = Bill
|
||||
success_url = reverse_lazy("finance:bill_list")
|
||||
template_name = "finance/bill_create.html"
|
||||
|
||||
def form_valid(self, form):
|
||||
@@ -49,6 +48,13 @@ class BillCreateView(LoginRequiredMixin, CreateView):
|
||||
kwargs["user"] = self.request.user
|
||||
return kwargs
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse("finance:bill_create_done", kwargs={"pk": self.object.pk})
|
||||
|
||||
|
||||
class BillCreateDoneView(LoginRequiredMixin, TemplateView):
|
||||
template_name = "finance/bill_create_done.html"
|
||||
|
||||
|
||||
class BillListView(LoginRequiredMixin, ListView):
|
||||
model = Bill
|
||||
|
||||
15
fet2020/templates/finance/bill_create_done.html
Normal file
15
fet2020/templates/finance/bill_create_done.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Rechnung wurde erfolgreich eingereicht{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<section class="w-full text-center">
|
||||
<p class="mt-6 text-base leading-7 text-proprietary dark:text-sky-600">Rechnung #{{pk}} wurde erfolgreich eingereicht.</p>
|
||||
<div class="mt-10 flex items-center justify-center gap-x-6">
|
||||
<a href="{% url 'home' %}" type="submit" class="block btn btn-primary">Zur Startseite</a>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user