Энергия НК (Запретил отключение режима множества участков)

This commit is contained in:
zakhy 2025-02-26 16:36:40 +07:00
parent 0664a2b0f7
commit 93929f7d31

View File

@ -17,6 +17,7 @@ from django.views.decorators.cache import never_cache
from apps.general.models.model_settings import Settings
from apps.general.views import settingsmodule
from apps.geoproc.models.model_sector import Sector
from apps.gto.models.model_type_icons import ModelTypeIcons
from apps.management.views import views_user
from apps.util import generalmodule
@ -69,6 +70,12 @@ def oset_save(request):
for param in post_param:
if param == "csrfmiddlewaretoken":
continue
if param == "geoproc_many_sectors":
# TODO вынужденный костыль. До переработки системы настроек
another_sectors_exists = Sector.objects.all().exclude(
name="Основной участок").exists()
if another_sectors_exists:
continue
element_link = Settings.objects.filter(name=param).first()
if element_link is None:
Settings.objects.create(name=param, value=post_param[param])