136 lines
3.7 KiB
Python
136 lines
3.7 KiB
Python
from django.contrib import admin
|
|
from .models import (
|
|
AnalysisGridCell,
|
|
AnalysisGridObservation,
|
|
BlockSubdivision,
|
|
RemoteSensingClusterAssignment,
|
|
RemoteSensingRun,
|
|
RemoteSensingSubdivisionResult,
|
|
SoilLocation,
|
|
)
|
|
|
|
|
|
class BlockSubdivisionInline(admin.TabularInline):
|
|
model = BlockSubdivision
|
|
extra = 0
|
|
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)
|
|
class SoilLocationAdmin(admin.ModelAdmin):
|
|
list_display = ("id", "latitude", "longitude", "is_complete", "created_at")
|
|
list_filter = ("created_at",)
|
|
search_fields = ("latitude", "longitude")
|
|
readonly_fields = ("created_at", "updated_at")
|
|
inlines = [BlockSubdivisionInline]
|
|
|
|
|
|
@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",
|
|
"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")
|