rework main models
This commit is contained in:
@@ -6,6 +6,7 @@ from .models import (
|
||||
Standard,
|
||||
SigmaParMark,
|
||||
SigmaParameter,
|
||||
SourceType,
|
||||
Parameter,
|
||||
Satellite,
|
||||
Mirror,
|
||||
@@ -128,6 +129,12 @@ class ModulationAdmin(admin.ModelAdmin):
|
||||
search_fields = ("name",)
|
||||
ordering = ("name",)
|
||||
|
||||
@admin.register(SourceType)
|
||||
class ModulationAdmin(admin.ModelAdmin):
|
||||
list_display = ("name",)
|
||||
search_fields = ("name",)
|
||||
ordering = ("name",)
|
||||
|
||||
|
||||
@admin.register(Standard)
|
||||
class StandardAdmin(admin.ModelAdmin):
|
||||
@@ -209,23 +216,25 @@ class ParameterAdmin(ImportExportActionModelAdmin, admin.ModelAdmin):
|
||||
class SigmaParameterAdmin(ImportExportActionModelAdmin, admin.ModelAdmin):
|
||||
list_display = (
|
||||
"id_satellite",
|
||||
"status",
|
||||
# "status",
|
||||
"frequency",
|
||||
"transfer_frequency",
|
||||
"freq_range",
|
||||
"power",
|
||||
# "power",
|
||||
"polarization",
|
||||
"modulation",
|
||||
"bod_velocity",
|
||||
"snr",
|
||||
"standard",
|
||||
# "standard",
|
||||
"parameter",
|
||||
"packets",
|
||||
# "packets",
|
||||
"datetime_begin",
|
||||
"datetime_end",
|
||||
)
|
||||
readonly_fields = (
|
||||
"datetime_begin",
|
||||
"datetime_end",
|
||||
|
||||
"datetime_end",
|
||||
"transfer_frequency"
|
||||
)
|
||||
list_display_links = ("id_satellite",)
|
||||
list_filter = (
|
||||
@@ -401,7 +410,7 @@ class ObjectAdmin(admin.ModelAdmin):
|
||||
)
|
||||
search_fields = (
|
||||
"name",
|
||||
# "id_geo",
|
||||
"id_geo__coords",
|
||||
# "id_satellite__name",
|
||||
# "id_vch_load__frequency",
|
||||
)
|
||||
@@ -413,6 +422,7 @@ class ObjectAdmin(admin.ModelAdmin):
|
||||
"id_vch_load__modulation",
|
||||
"id_vch_load__id_satellite",
|
||||
"id_geo",
|
||||
"id_source_type"
|
||||
)
|
||||
autocomplete_fields = ("id_geo",)
|
||||
raw_id_fields = ("id_vch_load",)
|
||||
@@ -422,11 +432,13 @@ class ObjectAdmin(admin.ModelAdmin):
|
||||
def sat_name(self, obj):
|
||||
return obj.id_vch_load.id_satellite
|
||||
sat_name.short_description = "Спутник"
|
||||
sat_name.admin_order_field = "id_vch_load__id_satellite__name"
|
||||
|
||||
def freq(self, obj):
|
||||
par = obj.id_vch_load
|
||||
return par.frequency
|
||||
freq.short_description = "Частота, МГц"
|
||||
freq.admin_order_field = "id_vch_load__frequency"
|
||||
|
||||
def distance_geo_kup(self, obj):
|
||||
par = obj.id_geo.distance_coords_kup
|
||||
@@ -458,6 +470,7 @@ class ObjectAdmin(admin.ModelAdmin):
|
||||
par = obj.id_vch_load
|
||||
return par.freq_range
|
||||
freq_range.short_description = "Полоса, МГц"
|
||||
freq_range.admin_order_field = "id_vch_load__freq_range"
|
||||
|
||||
def bod_velocity(self, obj):
|
||||
par = obj.id_vch_load
|
||||
@@ -482,6 +495,7 @@ class ObjectAdmin(admin.ModelAdmin):
|
||||
lat = f"{latitude}N" if latitude > 0 else f"{abs(latitude)}S"
|
||||
return f"{lat} {lon}"
|
||||
geo_coords.short_description = "Координаты геолокации"
|
||||
geo_coords.admin_order_filed = "id_geo__coords"
|
||||
|
||||
def kupsat_coords(self, obj):
|
||||
obj = obj.id_geo
|
||||
|
||||
Reference in New Issue
Block a user