Add activity pages

Signed-off-by: Etzelia <etzelia@hotmail.com>
develop
Etzelia 2019-08-16 11:46:09 -05:00
parent a63f482d96
commit 712ed95173
No known key found for this signature in database
GPG Key ID: 3CAEB74806C4ADE5
15 changed files with 295 additions and 381 deletions

55
activity.py 100644
View File

@ -0,0 +1,55 @@
from django_coreprotect.models import SessionResult, ActivityResult
from django_coreprotect.utils import safe_int
class ActivityForm:
def __init__(self):
self.players = ""
self.date_from = ""
self.date_to = ""
def activity_data(request):
request_data = request.GET
form = ActivityForm()
# Players
form.players = request_data["players"] if "players" in request_data else ""
# Date and Time
form.date_from = request_data["date_from"] if "date_from" in request_data else ""
form.date_to = request_data["date_to"] if "date_to" in request_data else ""
return form
def activity_results(form):
query = ""
players = []
if form.players:
for player in form.players.split(","):
players.append(player.strip())
players_clause = " WHERE ({}) ".format(" OR ".join(["player LIKE '%{}%'".format(p) for p in players]))
query = '''SELECT
0 AS id, cs.time AS unix, cu.user AS player, cs.action
FROM co_session cs
JOIN co_user cu ON cs.user = cu.id
{players}
'''.format(players=players_clause)
if query:
print(query)
sessions = SessionResult.objects.raw(query)
activity = {}
for session in sessions:
time = -safe_int(session.unix) if session.action == 1 else safe_int(session.unix)
if session.player in activity:
activity[session.player] += time
else:
activity[session.player] = time
results = []
for player, time in activity.items():
results.append(ActivityResult(player, time))
return results
return []

View File

@ -1,7 +1,9 @@
from django_coreprotect.models import *
from django_coreprotect.models import CoWorld, GUIResult
from django_coreprotect.utils import safe_int, checkbox
from datetime import datetime
class Form:
class GUIForm:
def __init__(self):
self.block_break = False
@ -14,6 +16,7 @@ class Form:
self.sign_place = False
self.worlds = []
self.ignore_environment = False
self.oldest_first = False
self.page = ""
self.page_size = ""
self.start = ""
@ -27,20 +30,9 @@ class Form:
self.date_to = ""
def checkbox(value):
return True if value == "on" else False
def safe_int(value):
try:
return int(value)
except:
return 0
def form_data(request):
def gui_data(request):
request_data = request.GET
form = Form()
form = GUIForm()
worlds = CoWorld.objects.all()
# Actions
@ -72,6 +64,7 @@ def form_data(request):
# Options
form.ignore_environment = checkbox(request_data["ignore_environment"]) if "ignore_environment" in request_data else False
form.oldest_first = checkbox(request_data["oldest_first"]) if "oldest_first" in request_data else False
# Limit Results
form.page = request_data["page"] if "page" in request_data else "0"
@ -99,9 +92,10 @@ def form_data(request):
return form
def result_data(form):
def gui_results(form):
queries = []
ignore_environment = " AND player NOT LIKE '#%' " if form.ignore_environment else ""
oldest_first = " ASC " if form.oldest_first else " DESC "
coords = []
radius = form.radius if form.radius else "0"
@ -226,8 +220,7 @@ def result_data(form):
query = " UNION ".join(queries)
if query:
query += " ORDER BY unix DESC LIMIT {}, {}".format(form.start, form.page_size)
print(query)
query += " ORDER BY unix {} LIMIT {}, {}".format(oldest_first, form.start, form.page_size)
if query:
return CoResult.objects.raw(query)
return []
return GUIResult.objects.raw(query)
return []

View File

@ -1,322 +0,0 @@
# Generated by Django 2.2.3 on 2019-08-16 03:39
import django.contrib.auth.models
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='CoArtMap',
fields=[
('id', models.IntegerField(primary_key=True, serialize=False)),
('art', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'Art Map',
'verbose_name_plural': 'Art Maps',
'db_table': 'co_art_map',
'managed': False,
},
),
migrations.CreateModel(
name='CoBlock',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time', models.IntegerField(blank=True, null=True)),
('user', models.IntegerField(blank=True, null=True)),
('wid', models.IntegerField(blank=True, null=True)),
('x', models.IntegerField(blank=True, null=True)),
('y', models.IntegerField(blank=True, null=True)),
('z', models.IntegerField(blank=True, null=True)),
('type', models.IntegerField(blank=True, null=True)),
('data', models.IntegerField(blank=True, null=True)),
('meta', models.BinaryField(blank=True, null=True)),
('blockdata', models.BinaryField(blank=True, null=True)),
('action', models.IntegerField(blank=True, null=True)),
('rolled_back', models.IntegerField(blank=True, null=True)),
],
options={
'verbose_name': 'Block',
'verbose_name_plural': 'Blocks',
'db_table': 'co_block',
'managed': False,
},
),
migrations.CreateModel(
name='CoBlockdataMap',
fields=[
('id', models.IntegerField(primary_key=True, serialize=False)),
('data', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'BlockData Map',
'verbose_name_plural': 'BlockData Maps',
'db_table': 'co_blockdata_map',
'managed': False,
},
),
migrations.CreateModel(
name='CoChat',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time', models.IntegerField(blank=True, null=True)),
('user', models.IntegerField(blank=True, null=True)),
('message', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'Chat Message',
'verbose_name_plural': 'Chat Messages',
'db_table': 'co_chat',
'managed': False,
},
),
migrations.CreateModel(
name='CoCommand',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time', models.IntegerField(blank=True, null=True)),
('user', models.IntegerField(blank=True, null=True)),
('message', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'Command',
'verbose_name_plural': 'Commands',
'db_table': 'co_command',
'managed': False,
},
),
migrations.CreateModel(
name='CoContainer',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time', models.IntegerField(blank=True, null=True)),
('user', models.IntegerField(blank=True, null=True)),
('wid', models.IntegerField(blank=True, null=True)),
('x', models.IntegerField(blank=True, null=True)),
('y', models.IntegerField(blank=True, null=True)),
('z', models.IntegerField(blank=True, null=True)),
('type', models.IntegerField(blank=True, null=True)),
('data', models.IntegerField(blank=True, null=True)),
('amount', models.IntegerField(blank=True, null=True)),
('metadata', models.BinaryField(blank=True, null=True)),
('action', models.IntegerField(blank=True, null=True)),
('rolled_back', models.IntegerField(blank=True, null=True)),
],
options={
'verbose_name': 'Container Transaction',
'verbose_name_plural': 'Container Transactions',
'db_table': 'co_container',
'managed': False,
},
),
migrations.CreateModel(
name='CoDatabaseLock',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.IntegerField(blank=True, null=True)),
('time', models.IntegerField(blank=True, null=True)),
],
options={
'verbose_name': 'Database Lock',
'verbose_name_plural': 'Database Locks',
'db_table': 'co_database_lock',
'managed': False,
},
),
migrations.CreateModel(
name='CoEntity',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time', models.IntegerField(blank=True, null=True)),
('data', models.BinaryField(blank=True, null=True)),
],
options={
'verbose_name': 'Entity',
'verbose_name_plural': 'Entities',
'db_table': 'co_entity',
'managed': False,
},
),
migrations.CreateModel(
name='CoEntityMap',
fields=[
('id', models.IntegerField(primary_key=True, serialize=False)),
('entity', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'Entity Mapping',
'verbose_name_plural': 'Entity Mappings',
'db_table': 'co_entity_map',
'managed': False,
},
),
migrations.CreateModel(
name='CoMaterialMap',
fields=[
('id', models.IntegerField(primary_key=True, serialize=False)),
('material', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'Material Mapping',
'verbose_name_plural': 'Material Mappings',
'db_table': 'co_material_map',
'managed': False,
},
),
migrations.CreateModel(
name='CoResult',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('type', models.TextField()),
('unix', models.TextField()),
('player', models.TextField()),
('action', models.TextField()),
('data', models.TextField()),
('x', models.TextField()),
('y', models.TextField()),
('z', models.TextField()),
('world', models.TextField()),
],
options={
'verbose_name': 'Result',
'verbose_name_plural': 'Results',
'managed': False,
},
),
migrations.CreateModel(
name='CoSession',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time', models.IntegerField(blank=True, null=True)),
('user', models.IntegerField(blank=True, null=True)),
('wid', models.IntegerField(blank=True, null=True)),
('x', models.IntegerField(blank=True, null=True)),
('y', models.IntegerField(blank=True, null=True)),
('z', models.IntegerField(blank=True, null=True)),
('action', models.IntegerField(blank=True, null=True)),
],
options={
'verbose_name': 'Session',
'verbose_name_plural': 'Sessions',
'db_table': 'co_session',
'managed': False,
},
),
migrations.CreateModel(
name='CoSign',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time', models.IntegerField(blank=True, null=True)),
('user', models.IntegerField(blank=True, null=True)),
('wid', models.IntegerField(blank=True, null=True)),
('x', models.IntegerField(blank=True, null=True)),
('y', models.IntegerField(blank=True, null=True)),
('z', models.IntegerField(blank=True, null=True)),
('color', models.IntegerField(blank=True, null=True)),
('line_1', models.TextField(blank=True, null=True)),
('line_2', models.TextField(blank=True, null=True)),
('line_3', models.TextField(blank=True, null=True)),
('line_4', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'Sign',
'verbose_name_plural': 'Signs',
'db_table': 'co_sign',
'managed': False,
},
),
migrations.CreateModel(
name='CoSkull',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time', models.IntegerField(blank=True, null=True)),
('owner', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'Skull',
'verbose_name_plural': 'Skulls',
'db_table': 'co_skull',
'managed': False,
},
),
migrations.CreateModel(
name='CoUser',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time', models.IntegerField(blank=True, null=True)),
('user', models.TextField(blank=True, null=True)),
('uuid', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'User',
'verbose_name_plural': 'Users',
'db_table': 'co_user',
'managed': False,
},
),
migrations.CreateModel(
name='CoUsernameLog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time', models.IntegerField(blank=True, null=True)),
('uuid', models.TextField(blank=True, null=True)),
('user', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'Username',
'verbose_name_plural': 'Usernames',
'db_table': 'co_username_log',
'managed': False,
},
),
migrations.CreateModel(
name='CoVersion',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('time', models.IntegerField(blank=True, null=True)),
('version', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'Version',
'verbose_name_plural': 'Versions',
'db_table': 'co_version',
'managed': False,
},
),
migrations.CreateModel(
name='CoWorld',
fields=[
('id', models.IntegerField(primary_key=True, serialize=False)),
('world', models.TextField(blank=True, null=True)),
],
options={
'verbose_name': 'World',
'verbose_name_plural': 'Worlds',
'db_table': 'co_world',
'managed': False,
},
),
migrations.CreateModel(
name='CoreProtectUser',
fields=[
],
options={
'permissions': (('gui', 'Can use CoreProtect GUI'), ('gui_extra', 'Can search Chat/Commands'), ('activity', 'Can use CoreProtect Activity Monitor')),
'proxy': True,
'indexes': [],
'constraints': [],
},
bases=('auth.user',),
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
]

View File

@ -1,6 +1,7 @@
from django.db import models
from django.contrib.auth.models import User
from datetime import datetime
from django_coreprotect.utils import safe_int
class CoreProtectUser(User):
@ -290,7 +291,7 @@ class CoWorld(models.Model):
return self.world
class CoResult(models.Model):
class GUIResult(models.Model):
type = models.TextField()
unix = models.TextField()
player = models.TextField()
@ -338,5 +339,35 @@ class CoResult(models.Model):
class Meta:
managed = False
verbose_name = "Result"
verbose_name_plural = "Results"
verbose_name = "GUI Result"
verbose_name_plural = "GUI Results"
class SessionResult(models.Model):
unix = models.TextField()
player = models.TextField()
action = models.TextField()
class Meta:
managed = False
verbose_name = "Session Result"
verbose_name_plural = "Session Results"
class ActivityResult:
def __init__(self, player, time):
self.player = player
self.time = time
@property
def time_display(self):
time = safe_int(self.time)
seconds = time % 60
time //= 60
minutes = time % 60
time //= 60
hours = time % 24
time //= 24
days = time
return "{}d, {}h, {}m, {}s".format(days, hours, minutes, seconds)

View File

@ -1,3 +1,7 @@
.click-row {
cursor: pointer;
}
form {
margin-left: 7rem;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

View File

@ -0,0 +1,84 @@
{% extends "coreprotect/base.html" %}
{% load static %}
{% block head %}
<link rel="shortcut icon" type="image/png" href="{% static 'coreprotect/img/ymca.png' %}"/>
{% endblock %}
{% block body %}
<div class="block"></div>
<div class="has-text-centered">
<h1 class="title">CoreProtect Activity Monitor</h1>
<hr/>
</div>
<div class="columns">
<form id="coreprotect_form" name="coreprotect_form" class="has-text-left column is-one-fifth">
<h4 class="title is-5 has-text-primary">
Players
</h4>
<div class="field tooltip" data-tooltip="Accepts full or partial names. Separated by commas.">
<input class="input" id="players" name="players" type="text" placeholder="Player Names" value="{{form.players}}">
</div>
<br/>
<h4 class="title is-5 has-text-primary">
Date and Time
</h4>
<div class="field tooltip" data-tooltip="Click to open date/time picker.">
<p class="control">
<input type="date" id="date_from" name="date_from" placeholder="Date From" value="{{form.date_from}}">
</p>
</div>
<div class="field tooltip" data-tooltip="Click to open date/time picker.">
<p class="control">
<input type="date" id="date_to" name="date_to" placeholder="Date To" value="{{form.date_to}}">
</p>
</div>
<br/>
<div class="field is-grouped">
<p class="control">
<button class="button is-primary" id="search" type="button">Search</button>
</p>
<p class="control">
<button class="button is-dark" id="clear" type="button">Clear</button>
</p>
<p class="control">
<button class="button is-info" id="export" type="button">Export</button>
</p>
</div>
</form>
<div class="column is-three-fifths" id="results">
</div>
</div>
{% endblock %}
{% block script %}
<script>
document.getElementById("search").addEventListener("click", function() {
elementHTML("results", 'Querying Database...<br/><progress class="progress is-primary"></progress>');
let form = document.getElementById("coreprotect_form");
let formData = new FormData(form);
ajax("GET", "{% url "coreprotect_activity_query" %}?" + formURI(formData), function(status, data) {
elementHTML("results", data);
});
window.history.pushState("", "", "{% url "coreprotect_activity" %}?" + formURI(formData));
});
document.getElementById("clear").addEventListener("click", function() {
// Players
document.getElementById("players").value = "";
// Date and Time
document.getElementById("date_from")._flatpickr.setDate();
document.getElementById("date_to")._flatpickr.setDate();
});
document.getElementById("export").addEventListener("click", function() {
exportTableToCSV("activity.csv", "results");
});
</script>
{% endblock %}

View File

@ -0,0 +1,23 @@
{% load static %}
<!doctype html>
<html lang="en">
<head>
<title>CoreProtect Web Interface</title>
{% block head %}{% endblock %}
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ubuntu"/>
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/bulma.min.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/bulma.dark.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/bulma-extensions.min.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/flatpickr.min.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/flatpickr.dark.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/main.css' %}"/>
</head>
<body>
{% block body %}{% endblock %}
</body>
<script src="{% static 'coreprotect/js/bulma-extensions.min.js' %}"></script>
<script src="{% static 'coreprotect/js/flatpickr.js' %}"></script>
<script src="{% static 'coreprotect/js/main.js' %}"></script>
{% block script %}{% endblock %}
</html>

View File

@ -1,29 +1,16 @@
{% extends "coreprotect/base.html" %}
{% load static %}
<!doctype html>
<html lang="en">
<head>
<title>CoreProtect Web Interface</title>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ubuntu" >
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/bulma.min.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/bulma.dark.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/bulma-extensions.min.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/flatpickr.min.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/flatpickr.dark.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'coreprotect/css/main.css' %}"/>
<script src="{% static 'coreprotect/js/flatpickr.js' %}"></script>
</head>
<body>
{% block head %}
<link rel="shortcut icon" type="image/png" href="{% static 'coreprotect/img/intelli.png' %}"/>
{% endblock %}
{% block body %}
<div class="block"></div>
<div class="has-text-centered">
<h1 class="title">CoreProtect Web GUI</h1>
<h1 class="title">CoreProtect GUI</h1>
<hr/>
</div>
<div class="columns">
<form style="margin-left: 7rem;" id="coreprotect_form" name="coreprotect_form" class="has-text-left column is-one-third">
<form id="coreprotect_form" name="coreprotect_form" class="has-text-left column is-one-third">
<div class="columns">
<div class="column is-one-half">
<h4 class="title is-5 has-text-primary">
@ -83,6 +70,10 @@
<input class="is-checkradio is-block is-info" id="ignore_environment" name="ignore_environment" type="checkbox" {% if form.ignore_environment %}checked{% endif %}>
<label for="ignore_environment">Ignore Environment</label>
</div>
<div class="field">
<input class="is-checkradio is-block is-info" id="oldest_first" name="oldest_first" type="checkbox" {% if form.oldest_first %}checked{% endif %}>
<label for="oldest_first">Oldest Results First</label>
</div>
<br/>
@ -182,9 +173,8 @@
</div>
</div>
</body>
<script src="{% static 'coreprotect/js/bulma-extensions.min.js' %}"></script>
<script src="{% static 'coreprotect/js/main.js' %}"></script>
{% endblock %}
{% block script %}
<script>
let text = "Copy the below command to teleport";
function attachClickRows() {
@ -232,12 +222,12 @@
let form = document.getElementById("coreprotect_form");
let formData = new FormData(form);
ajax("GET", "{% url "coreprotect_query" %}?" + formURI(formData), function(status, data) {
ajax("GET", "{% url "coreprotect_gui_query" %}?" + formURI(formData), function(status, data) {
elementHTML("results", data);
attachClickRows();
attachPagination();
});
window.history.pushState("", "", "{% url "coreprotect_index" %}?" + formURI(formData));
window.history.pushState("", "", "{% url "coreprotect_gui" %}?" + formURI(formData));
}
document.getElementById("search").addEventListener("click", function() {
@ -262,6 +252,7 @@
// Options
document.getElementById("ignore_environment").checked = false;
document.getElementById("oldest_first").checked = false;
// Page Size
document.getElementById("page_size").selectedIndex = "0";
@ -288,4 +279,4 @@
exportTableToCSV("coreprotect.csv", "results");
});
</script>
</html>
{% endblock %}

View File

@ -0,0 +1,16 @@
<table class="table is-fullwidth is-striped is-bordered">
<thead>
<tr>
<th>Player</th>
<th>Time</th>
</tr>
</thead>
<tbody>
{% for result in results %}
<tr>
<td>{{ result.player }}</td>
<td>{{ result.time_display }}</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -1,8 +1,10 @@
from django.urls import path
from django.contrib.auth.decorators import permission_required
from django_coreprotect.views import Home, Query
from django_coreprotect.views import GUI, GUIQuery, Activity, ActivityQuery
urlpatterns = [
path('', permission_required('django_coreprotect.gui')(Home.as_view()), name="coreprotect_index"),
path('query/', permission_required('django_coreprotect.gui')(Query.as_view()), name="coreprotect_query"),
path('', permission_required('django_coreprotect.gui')(GUI.as_view()), name="coreprotect_gui"),
path('query/', permission_required('django_coreprotect.gui')(GUIQuery.as_view()), name="coreprotect_gui_query"),
path('activity/', permission_required('django_coreprotect.activity')(Activity.as_view()), name="coreprotect_activity"),
path('activity/query/', permission_required('django_coreprotect.activity')(ActivityQuery.as_view()), name="coreprotect_activity_query"),
]

9
utils.py 100644
View File

@ -0,0 +1,9 @@
def checkbox(value):
return True if value == "on" else False
def safe_int(value):
try:
return int(value)
except:
return 0

View File

@ -1,24 +1,26 @@
from django.shortcuts import render
from django.views.generic import View
from django.http.response import JsonResponse
from django_coreprotect.forms import *
from django_coreprotect.gui import gui_data, gui_results
from django_coreprotect.activity import activity_data, activity_results
from django_coreprotect.utils import safe_int
class Home(View):
class GUI(View):
def get(self, request):
form = form_data(request)
form = gui_data(request)
return render(request, "coreprotect/coreprotect.html", {"form": form})
def post(self, request):
pass
class Query(View):
class GUIQuery(View):
def get(self, request):
form = form_data(request)
results = result_data(form)
form = gui_data(request)
results = gui_results(form)
if "format" in request.GET and request.GET["format"] == "json":
return JsonResponse(results)
@ -29,7 +31,33 @@ class Query(View):
if len(results) == safe_int(form.page_size):
next_page = True
return render(request, "coreprotect/table.html", {"results": results, "num": len(results), "prev": prev_page, "next": next_page})
return render(request, "coreprotect/table/coreprotect.html", {"results": results, "num": len(results), "prev": prev_page, "next": next_page})
def post(self, request):
pass
class Activity(View):
def get(self, request):
form = activity_data(request)
return render(request, "coreprotect/activity.html", {"form": form})
def post(self, request):
pass
class ActivityQuery(View):
def get(self, request):
form = activity_data(request)
results = activity_results(form)
if "format" in request.GET and request.GET["format"] == "json":
return JsonResponse(results)
return render(request, "coreprotect/table/activity.html", {"results": results})
def post(self, request):
pass