diff --git a/apps/treasury/urls.py b/apps/treasury/urls.py index 7cd68ec0..1ec061c9 100644 --- a/apps/treasury/urls.py +++ b/apps/treasury/urls.py @@ -3,9 +3,11 @@ from django.urls import path -from .views import BillingListView +from .views import BillingCreateView, BillingListView, BillingUpdateView app_name = 'treasury' urlpatterns = [ path('billing/', BillingListView.as_view(), name='billing'), + path('billing/create/', BillingCreateView.as_view(), name='billing_create'), + path('billing//', BillingUpdateView.as_view(), name='billing_update'), ] diff --git a/apps/treasury/views.py b/apps/treasury/views.py index 435f8cdb..a07d1068 100644 --- a/apps/treasury/views.py +++ b/apps/treasury/views.py @@ -2,15 +2,34 @@ # SPDX-License-Identifier: GPL-3.0-or-later from django.contrib.auth.mixins import LoginRequiredMixin +from django.views.generic import CreateView, UpdateView from django_tables2 import SingleTableView from .models import Billing from .tables import BillingTable +class BillingCreateView(LoginRequiredMixin, CreateView): + """ + Create Billing + """ + model = Billing + fields = '__all__' + # form_class = ClubForm + + class BillingListView(LoginRequiredMixin, SingleTableView): """ List existing Billings """ model = Billing table_class = BillingTable + + +class BillingUpdateView(LoginRequiredMixin, UpdateView): + """ + Create Billing + """ + model = Billing + fields = '__all__' + # form_class = ClubForm diff --git a/templates/treasury/billing_form.html b/templates/treasury/billing_form.html new file mode 100644 index 00000000..d72e15c5 --- /dev/null +++ b/templates/treasury/billing_form.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} +{% load static %} +{% load i18n %} +{% load crispy_forms_tags %} +{% block content %} +

{% trans "Billings list" %}

+
+{% csrf_token %} +{{form|crispy}} + +
+{% endblock %} diff --git a/templates/treasury/billing_list.html b/templates/treasury/billing_list.html index 1cc473f1..1ba40557 100644 --- a/templates/treasury/billing_list.html +++ b/templates/treasury/billing_list.html @@ -5,7 +5,7 @@ {% render_table table %} -{% trans "New billing" %} +{% trans "New billing" %} {% endblock %} {% block extrajavascript %}