Add paginated transaction view
This commit is contained in:
parent
e4f70c67e3
commit
fdcdff7bcc
4 changed files with 50 additions and 4 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue