Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Soil ID Cache to Django admin #1417

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions terraso_backend/apps/soil_id/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
SoilData,
SoilDataDepthInterval,
)
from apps.soil_id.models.soil_id_cache import SoilIdCache


class DepthDependentSoilDataInline(admin.TabularInline):
Expand Down Expand Up @@ -65,3 +66,8 @@ def project(self, obj):
DepthDependentSoilDataInline,
SoilDataDepthIntervalInline,
]


@admin.register(SoilIdCache)
class SoilIdCacheAdmin(admin.ModelAdmin):
list_display = ["id", "latitude", "longitude"]
2 changes: 2 additions & 0 deletions terraso_backend/apps/soil_id/models/soil_id_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class Meta:
constraints = [
models.UniqueConstraint(fields=["latitude", "longitude"], name="coordinate_index")
]
verbose_name = "Soil ID Cache"
verbose_name_plural = "Soil ID Cache"

@classmethod
def round_coordinate(cls, coord: float):
Expand Down
Loading