Skip to content
Snippets Groups Projects
Commit a823176b authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Add MyInvoicesListView

parent 5a806de1
No related branches found
No related tags found
No related merge requests found
{% extends "core/base.html" %}
{% load material_form i18n %}
{% load render_table from django_tables2 %}
{% block page_title %}{% blocktrans %}My invoices{% endblocktrans %}{% endblock %}
{% block browser_title %}{% blocktrans %}My invoices{% endblocktrans %}{% endblock %}
{% block content %}
{% render_table table %}
{% endblock %}
......@@ -234,3 +234,16 @@ class SendInvoiceEmail(PermissionRequiredMixin, View):
url = Invoice.objects.get(token=token).get_absolute_url()
return redirect(url)
class MyInvoicesListView(PermissionRequiredMixin, SingleTableView):
"""Table of all invoices belonging to a user."""
model = Invoice
table_class = InvoicesTable
permission_required = "tezor.view_invoices_rule"
template_name = "tezor/invoice/list.html"
def get_queryset(self, request, *args, **kwargs):
invoices = self.model.objects.filter(person=request.user.person)
return invoices
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment