|
|
@ -25,6 +25,7 @@ from django.db.models import Count
|
|
|
|
from django.contrib import auth
|
|
|
|
from django.contrib import auth
|
|
|
|
from django.contrib.auth.models import User
|
|
|
|
from django.contrib.auth.models import User
|
|
|
|
from django_countries import countries
|
|
|
|
from django_countries import countries
|
|
|
|
|
|
|
|
import lcoreapi
|
|
|
|
|
|
|
|
|
|
|
|
from payments.models import ACTIVE_BACKENDS
|
|
|
|
from payments.models import ACTIVE_BACKENDS
|
|
|
|
from .forms import SignupForm, ReqEmailForm
|
|
|
|
from .forms import SignupForm, ReqEmailForm
|
|
|
@ -270,13 +271,19 @@ def logs(request):
|
|
|
|
|
|
|
|
|
|
|
|
base = core_api.info['current_instance']
|
|
|
|
base = core_api.info['current_instance']
|
|
|
|
path = '/users/' + request.user.username + '/sessions/'
|
|
|
|
path = '/users/' + request.user.username + '/sessions/'
|
|
|
|
|
|
|
|
try:
|
|
|
|
l = core_api.get(base + path, offset=offset, limit=page_size)
|
|
|
|
l = core_api.get(base + path, offset=offset, limit=page_size)
|
|
|
|
|
|
|
|
total_count = l['total_count']
|
|
|
|
|
|
|
|
items = l['items']
|
|
|
|
|
|
|
|
except lcoreapi.APINotFoundError:
|
|
|
|
|
|
|
|
total_count = 0
|
|
|
|
|
|
|
|
items = []
|
|
|
|
return render(request, 'lambdainst/logs.html', {
|
|
|
|
return render(request, 'lambdainst/logs.html', {
|
|
|
|
'sessions': l['items'],
|
|
|
|
'sessions': items,
|
|
|
|
'page': page,
|
|
|
|
'page': page,
|
|
|
|
'prev': page - 1 if page > 0 else None,
|
|
|
|
'prev': page - 1 if page > 0 else None,
|
|
|
|
'next': page + 1 if offset + page_size < l['total_count'] else None,
|
|
|
|
'next': page + 1 if offset + page_size < total_count else None,
|
|
|
|
'last_page': l['total_count'] // page_size,
|
|
|
|
'last_page': total_count // page_size,
|
|
|
|
'title': _("Logs"),
|
|
|
|
'title': _("Logs"),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|