From f3adc604246151a4ddfcc1ea2adf9b601c283d6f Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Fri, 6 Dec 2019 10:00:11 +0100 Subject: [PATCH] Create and code styles of billing view. --- musician/templates/musician/billing.html | 44 ++++++++++++++++++++++++ musician/urls.py | 1 + musician/views.py | 18 ++++++++++ 3 files changed, 63 insertions(+) create mode 100644 musician/templates/musician/billing.html diff --git a/musician/templates/musician/billing.html b/musician/templates/musician/billing.html new file mode 100644 index 0000000..f99d816 --- /dev/null +++ b/musician/templates/musician/billing.html @@ -0,0 +1,44 @@ +{% extends "musician/base.html" %} +{% load i18n %} + +{% block content %} + +

{% trans "Billing" %}

+

Little description of what to be expected...

+ + + + + + + + + + + + + + + + + + + + + + {% for bill in object_list %} + + + + + + + + + {% endfor %} + +{# TODO: define proper colspan #} +{% include "musician/components/table_paginator.html" %} +
NumberBill dateTypeTotalStatusDownload PDF
{{ bill.number }}{{ bill.date|date:"SHORT_DATE_FORMAT" }}{{ bill.type }}{{ bill.total_amount }}{{ bill.status }}
+ +{% endblock %} diff --git a/musician/urls.py b/musician/urls.py index e08bd0a..340d409 100644 --- a/musician/urls.py +++ b/musician/urls.py @@ -15,6 +15,7 @@ urlpatterns = [ path('auth/login/', views.LoginView.as_view(), name='login'), path('auth/logout/', views.LogoutView.as_view(), name='logout'), path('dashboard/', views.DashboardView.as_view(), name='dashboard'), + path('billing/', views.BillingView.as_view(), name='billing'), path('profile/', views.ProfileView.as_view(), name='profile'), path('mails/', views.MailView.as_view(), name='mails'), path('mailing-lists/', views.MailingListsView.as_view(), name='mailing-lists'), diff --git a/musician/views.py b/musician/views.py index 4f981e2..993ca01 100644 --- a/musician/views.py +++ b/musician/views.py @@ -36,6 +36,24 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): return context +class BillingView(CustomContextMixin, ExtendedPaginationMixin, UserTokenRequiredMixin, ListView): + template_name = "musician/billing.html" + + def get_queryset(self): + # TODO (@slamora) retrieve user bills + from django.utils import timezone + return [ + { + 'number': 24, + 'date': timezone.now(), + 'type': 'subscription', + 'total_amount': '25,00 €', + 'status': 'paid', + 'pdf_url': 'https://example.org/bill.pdf' + }, + ] + + class ProfileView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): template_name = "musician/profile.html"