Добавил зоны для спутников

This commit is contained in:
2025-12-08 15:48:46 +03:00
parent 8fb8b08c93
commit 25fe93231f
8 changed files with 128 additions and 29 deletions

View File

@@ -32,6 +32,7 @@ class SatelliteListView(LoginRequiredMixin, View):
# Get filter parameters
search_query = request.GET.get("search", "").strip()
selected_bands = request.GET.getlist("band_id")
selected_location_places = request.GET.getlist("location_place")
norad_min = request.GET.get("norad_min", "").strip()
norad_max = request.GET.get("norad_max", "").strip()
undersat_point_min = request.GET.get("undersat_point_min", "").strip()
@@ -58,6 +59,10 @@ class SatelliteListView(LoginRequiredMixin, View):
if selected_bands:
satellites = satellites.filter(band__id__in=selected_bands).distinct()
# Filter by location_place
if selected_location_places:
satellites = satellites.filter(location_place__in=selected_location_places)
# Filter by NORAD ID
if norad_min:
try:
@@ -154,6 +159,8 @@ class SatelliteListView(LoginRequiredMixin, View):
"-updated_at": "-updated_at",
"transponder_count": "transponder_count",
"-transponder_count": "-transponder_count",
"location_place": "location_place",
"-location_place": "-location_place",
}
if sort_param in valid_sort_fields:
@@ -169,10 +176,14 @@ class SatelliteListView(LoginRequiredMixin, View):
# Get band names
band_names = [band.name for band in satellite.band.all()]
# Get location_place display value
location_place_display = dict(Satellite.PLACES).get(satellite.location_place, "-") if satellite.location_place else "-"
processed_satellites.append({
'id': satellite.id,
'name': satellite.name or "-",
'alternative_name': satellite.alternative_name or "-",
'location_place': location_place_display,
'norad': satellite.norad if satellite.norad else "-",
'international_code': satellite.international_code or "-",
'bands': ", ".join(band_names) if band_names else "-",
@@ -200,6 +211,8 @@ class SatelliteListView(LoginRequiredMixin, View):
int(x) if isinstance(x, str) else x for x in selected_bands
if (isinstance(x, int) or (isinstance(x, str) and x.isdigit()))
],
'location_places': Satellite.PLACES,
'selected_location_places': selected_location_places,
'norad_min': norad_min,
'norad_max': norad_max,
'undersat_point_min': undersat_point_min,