Add paginated transaction view

This commit is contained in:
Edgar P. Burkhart 2022-05-22 17:07:57 +02:00
parent e4f70c67e3
commit fdcdff7bcc
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
4 changed files with 50 additions and 4 deletions

View file

@ -2,6 +2,9 @@ from django.shortcuts import render, get_object_or_404, redirect
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.contrib.auth import views as auth_views
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import ListView
from django.core.paginator import Paginator
from .models import (
Transaction,
@ -38,6 +41,13 @@ class LogoutView(auth_views.LogoutView):
next_page = "login"
class TransactionListView(LoginRequiredMixin, ListView):
paginate_by = 20
model = Transaction
template_name = "main/transactions.html"
context_object_name = "transactions"
@login_required
def transaction(request, uuid=None):
if uuid is None: