1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

Convert LOGS_PER_PAGE from static settings to appsettings

This commit is contained in:
catborise 2020-06-04 14:35:34 +03:00
parent 5e00f896d4
commit e21f423bcf

View file

@ -1,10 +1,10 @@
from django.conf import settings
from django.contrib.auth.models import Group, User from django.contrib.auth.models import Group, User
from django.core.paginator import Paginator from django.core.paginator import Paginator
from django.shortcuts import get_object_or_404, redirect, render from django.shortcuts import get_object_or_404, redirect, render
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from accounts.models import UserAttributes from accounts.models import UserAttributes
from appsettings.views import AppSettings
from logs.models import Logs from logs.models import Logs
from . import forms from . import forms
@ -165,7 +165,7 @@ def user_unblock(request, pk):
@superuser_only @superuser_only
def logs(request): def logs(request):
l = Logs.objects.order_by('-date') l = Logs.objects.order_by('-date')
paginator = Paginator(l, settings.LOGS_PER_PAGE) paginator = Paginator(l, int(AppSettings.objects.get(key="LOGS_PER_PAGE").value))
page = request.GET.get('page', 1) page = request.GET.get('page', 1)
logs = paginator.page(page) logs = paginator.page(page)
return render(request, 'admin/logs.html', {'logs': logs}) return render(request, 'admin/logs.html', {'logs': logs})