25 lines
944 B
Python
25 lines
944 B
Python
|
|
from django.contrib import admin
|
||
|
|
from .models import SoilDepthData, SoilLocation
|
||
|
|
|
||
|
|
|
||
|
|
class SoilDepthDataInline(admin.TabularInline):
|
||
|
|
model = SoilDepthData
|
||
|
|
extra = 0
|
||
|
|
readonly_fields = ("depth_label", "bdod", "cec", "cfvo", "clay", "nitrogen", "ocd", "ocs", "phh2o", "sand", "silt", "soc", "wv0010", "wv0033", "wv1500")
|
||
|
|
|
||
|
|
|
||
|
|
@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 = [SoilDepthDataInline]
|
||
|
|
|
||
|
|
|
||
|
|
@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")
|