1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

feat(operations): worker concurrency and job retention settings

This commit is contained in:
catborise 2026-10-13 18:12:54 +03:00
parent 18146c30a1
commit 34582d23f3
6 changed files with 94 additions and 1 deletions

View file

@ -9,6 +9,7 @@ from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.utils.translation import gettext_noop as _
from logs.views import addlogmsg
from operations.utils import BOUNDS
from appsettings.models import AppSettings
@ -112,6 +113,13 @@ def appsettings(request):
for setting in appsettings:
if setting.key in request.POST:
if setting.key in BOUNDS:
low, high, _default = BOUNDS[setting.key]
raw = request.POST.get(setting.key, "")
if not (raw.isascii() and raw.isdigit() and len(raw) <= 4 and low <= int(raw) <= high):
messages.error(request, _("%(setting)s must be a whole number between %(low)s and %(high)s")
% {"setting": setting.name, "low": low, "high": high})
return HttpResponseRedirect(request.get_full_path())
try:
setting.value = request.POST.get(setting.key, "")
setting.save()