Внёс мелкие правки и фиксы
This commit is contained in:
@@ -463,15 +463,20 @@ class SourceForm(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = Source
|
||||
fields = ['info']
|
||||
fields = ['info', 'ownership']
|
||||
widgets = {
|
||||
'info': forms.Select(attrs={
|
||||
'class': 'form-select',
|
||||
'id': 'id_info',
|
||||
}),
|
||||
'ownership': forms.Select(attrs={
|
||||
'class': 'form-select',
|
||||
'id': 'id_ownership',
|
||||
}),
|
||||
}
|
||||
labels = {
|
||||
'info': 'Тип объекта',
|
||||
'ownership': 'Принадлежность объекта',
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -607,9 +612,8 @@ class KubsatFilterForm(forms.Form):
|
||||
widget=forms.SelectMultiple(attrs={'class': 'form-select', 'size': '3'})
|
||||
)
|
||||
|
||||
# Заглушка для принадлежности объекта
|
||||
object_ownership = forms.MultipleChoiceField(
|
||||
choices=[],
|
||||
object_ownership = forms.ModelMultipleChoiceField(
|
||||
queryset=None,
|
||||
label='Принадлежность объекта',
|
||||
required=False,
|
||||
widget=forms.SelectMultiple(attrs={'class': 'form-select', 'size': '3'})
|
||||
@@ -658,7 +662,7 @@ class KubsatFilterForm(forms.Form):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
from mainapp.models import Band, ObjectInfo, Satellite, ObjItem
|
||||
from mainapp.models import Band, ObjectInfo, ObjectOwnership, Satellite, ObjItem
|
||||
from django.db.models import Exists, OuterRef
|
||||
|
||||
# Фильтруем спутники: только те, у которых есть источники с точками
|
||||
@@ -669,6 +673,7 @@ class KubsatFilterForm(forms.Form):
|
||||
self.fields['satellites'].queryset = satellites_with_sources
|
||||
self.fields['band'].queryset = Band.objects.all().order_by('name')
|
||||
self.fields['object_type'].queryset = ObjectInfo.objects.all().order_by('name')
|
||||
self.fields['object_ownership'].queryset = ObjectOwnership.objects.all().order_by('name')
|
||||
|
||||
|
||||
class TransponderForm(forms.ModelForm):
|
||||
|
||||
Reference in New Issue
Block a user