Внёс мелкие правки и фиксы

This commit is contained in:
2025-11-21 10:31:26 +03:00
parent c2c8c8799f
commit 58838614a5
13 changed files with 423 additions and 99 deletions

View File

@@ -71,6 +71,25 @@ class LinkLyngsatSourcesView(LoginRequiredMixin, FormMessageMixin, FormView):
matching_sources.sort(key=lambda x: abs(round(x.frequency, 1) - rounded_freq))
objitem.lyngsat_source = matching_sources[0]
objitem.save(update_fields=['lyngsat_source'])
# Update Source with ObjectInfo and ObjectOwnership for TV
if objitem.source:
from ..models import ObjectInfo, ObjectOwnership
try:
tv_type = ObjectInfo.objects.get(name="Стационарные")
tv_ownership = ObjectOwnership.objects.get(name="ТВ")
# Update source if not already set
if not objitem.source.info:
objitem.source.info = tv_type
if not objitem.source.ownership:
objitem.source.ownership = tv_ownership
objitem.source.save(update_fields=['info', 'ownership'])
except (ObjectInfo.DoesNotExist, ObjectOwnership.DoesNotExist):
# If types don't exist, skip this step
pass
linked_count += 1
messages.success(