diff --git a/terraso_backend/apps/collaboration/admin.py b/terraso_backend/apps/collaboration/admin.py index 1086cc3a1..8446fb8c2 100644 --- a/terraso_backend/apps/collaboration/admin.py +++ b/terraso_backend/apps/collaboration/admin.py @@ -24,10 +24,23 @@ class MembershipInline(admin.TabularInline): @admin.register(MembershipList) class MembershipListAdmin(admin.ModelAdmin): - list_display = ("id", "created_at") + list_display = ("project", "id", "created_at") inlines = [MembershipInline] + search_fields = ["project__name"] @admin.register(Membership) class MembershipAdmin(admin.ModelAdmin): - list_display = ("user", "membership_list", "user_role", "membership_status", "created_at") + @admin.display(ordering="membership_list__project") + def project(self, obj): + return obj.membership_list.project + + list_display = [ + "user", + "project", + "user_role", + "membership_status", + "membership_list", + "created_at", + ] + search_fields = ["user__email", "membership_list__project__name"] diff --git a/terraso_backend/apps/soil_id/admin.py b/terraso_backend/apps/soil_id/admin.py index bda1492c5..f4b520e49 100644 --- a/terraso_backend/apps/soil_id/admin.py +++ b/terraso_backend/apps/soil_id/admin.py @@ -42,6 +42,7 @@ class ProjectSoilSettingsAdmin(admin.ModelAdmin): inlines = [ ProjectDepthIntervalInline, ] + search_fields = ["project__name"] @admin.register(SoilData) @@ -58,7 +59,8 @@ def site_owner(self, obj): def project(self, obj): return obj.site.project.name if obj.site.project is not None else None - list_display = ("site_name", "project", "site_owner", "depth_interval_preset") + list_display = ["site_name", "project", "site_owner", "depth_interval_preset"] + search_fields = ["site__name", "site__project__name"] inlines = [ DepthDependentSoilDataInline, SoilDataDepthIntervalInline,