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 to django admin pages #1400

Merged
merged 2 commits into from
Aug 8, 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
17 changes: 15 additions & 2 deletions terraso_backend/apps/collaboration/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 3 additions & 1 deletion terraso_backend/apps/soil_id/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ProjectSoilSettingsAdmin(admin.ModelAdmin):
inlines = [
ProjectDepthIntervalInline,
]
search_fields = ["project__name"]


@admin.register(SoilData)
Expand All @@ -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,
Expand Down
Loading