Skip to content

Commit

Permalink
chore: add admin for observed taxa
Browse files Browse the repository at this point in the history
  • Loading branch information
mihow committed Aug 23, 2024
1 parent a8daac4 commit e5270ad
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ami/main/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ class ProjectAdmin(admin.ModelAdmin[Project]):

list_display = ("name", "priority", "active", "created_at", "updated_at")

# add action to update observed taxa for the project
@admin.action(description="Update observed taxa")
def update_observed_taxa(self, request: HttpRequest, queryset: QuerySet[Project]) -> None:
from ami.taxa.models import update_taxa_observed_for_project

for project in queryset:
update_taxa_observed_for_project(project)
self.message_user(request, f"Updated {queryset.count()} projects.")

actions = [update_observed_taxa]


@admin.register(Deployment)
class DeploymentAdmin(admin.ModelAdmin[Deployment]):
Expand Down

0 comments on commit e5270ad

Please sign in to comment.