Внёс мелкие правки и фиксы
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user