UPDATE
This commit is contained in:
+122
-10
@@ -1,11 +1,29 @@
|
||||
from django.contrib import admin
|
||||
from .models import SoilDepthData, SoilLocation
|
||||
from .models import (
|
||||
AnalysisGridCell,
|
||||
AnalysisGridObservation,
|
||||
BlockSubdivision,
|
||||
RemoteSensingClusterAssignment,
|
||||
RemoteSensingRun,
|
||||
RemoteSensingSubdivisionResult,
|
||||
SoilLocation,
|
||||
)
|
||||
|
||||
|
||||
class SoilDepthDataInline(admin.TabularInline):
|
||||
model = SoilDepthData
|
||||
class BlockSubdivisionInline(admin.TabularInline):
|
||||
model = BlockSubdivision
|
||||
extra = 0
|
||||
readonly_fields = ("depth_label", "bdod", "cec", "cfvo", "clay", "nitrogen", "ocd", "ocs", "phh2o", "sand", "silt", "soc", "wv0010", "wv0033", "wv1500")
|
||||
readonly_fields = (
|
||||
"block_code",
|
||||
"chunk_size_sqm",
|
||||
"grid_point_count",
|
||||
"centroid_count",
|
||||
"status",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
)
|
||||
fields = readonly_fields
|
||||
show_change_link = True
|
||||
|
||||
|
||||
@admin.register(SoilLocation)
|
||||
@@ -14,11 +32,105 @@ class SoilLocationAdmin(admin.ModelAdmin):
|
||||
list_filter = ("created_at",)
|
||||
search_fields = ("latitude", "longitude")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
inlines = [SoilDepthDataInline]
|
||||
inlines = [BlockSubdivisionInline]
|
||||
|
||||
|
||||
@admin.register(SoilDepthData)
|
||||
class SoilDepthDataAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "soil_location", "depth_label", "bdod", "cec", "phh2o", "clay", "sand", "silt")
|
||||
list_filter = ("depth_label",)
|
||||
search_fields = ("soil_location__latitude", "soil_location__longitude")
|
||||
@admin.register(BlockSubdivision)
|
||||
class BlockSubdivisionAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"soil_location",
|
||||
"block_code",
|
||||
"chunk_size_sqm",
|
||||
"grid_point_count",
|
||||
"centroid_count",
|
||||
"status",
|
||||
"updated_at",
|
||||
)
|
||||
list_filter = ("status", "chunk_size_sqm", "created_at")
|
||||
search_fields = ("block_code", "soil_location__latitude", "soil_location__longitude")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
|
||||
|
||||
@admin.register(RemoteSensingRun)
|
||||
class RemoteSensingRunAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"soil_location",
|
||||
"block_code",
|
||||
"provider",
|
||||
"chunk_size_sqm",
|
||||
"status",
|
||||
"temporal_start",
|
||||
"temporal_end",
|
||||
"created_at",
|
||||
)
|
||||
list_filter = ("provider", "status", "chunk_size_sqm", "created_at")
|
||||
search_fields = ("block_code", "soil_location__latitude", "soil_location__longitude")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
|
||||
|
||||
@admin.register(AnalysisGridCell)
|
||||
class AnalysisGridCellAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"cell_code",
|
||||
"soil_location",
|
||||
"block_code",
|
||||
"chunk_size_sqm",
|
||||
"centroid_lat",
|
||||
"centroid_lon",
|
||||
"created_at",
|
||||
)
|
||||
list_filter = ("chunk_size_sqm", "created_at")
|
||||
search_fields = ("cell_code", "block_code", "soil_location__latitude", "soil_location__longitude")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
|
||||
|
||||
@admin.register(AnalysisGridObservation)
|
||||
class AnalysisGridObservationAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"cell",
|
||||
"temporal_start",
|
||||
"temporal_end",
|
||||
"ndvi",
|
||||
"ndwi",
|
||||
"lst_c",
|
||||
"created_at",
|
||||
)
|
||||
list_filter = ("temporal_start", "temporal_end", "created_at")
|
||||
search_fields = ("cell__cell_code", "cell__block_code")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
|
||||
|
||||
|
||||
@admin.register(RemoteSensingSubdivisionResult)
|
||||
class RemoteSensingSubdivisionResultAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"soil_location",
|
||||
"block_code",
|
||||
"cluster_count",
|
||||
"chunk_size_sqm",
|
||||
"temporal_start",
|
||||
"temporal_end",
|
||||
"created_at",
|
||||
)
|
||||
list_filter = ("chunk_size_sqm", "cluster_count", "created_at")
|
||||
search_fields = ("block_code", "soil_location__latitude", "soil_location__longitude")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
|
||||
|
||||
@admin.register(RemoteSensingClusterAssignment)
|
||||
class RemoteSensingClusterAssignmentAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"result",
|
||||
"cell",
|
||||
"cluster_label",
|
||||
"created_at",
|
||||
)
|
||||
list_filter = ("cluster_label", "created_at")
|
||||
search_fields = ("cell__cell_code", "result__block_code")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
|
||||
Reference in New Issue
Block a user