Skip to content

Commit

Permalink
show version in published run admin
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Jul 3, 2024
1 parent 553b92c commit c4053bc
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions bots/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,18 @@ def api_integration_stats_url(self, bi: BotIntegration):
)


@admin.register(PublishedRunVersion)
class PublishedRunVersionAdmin(admin.ModelAdmin):
search_fields = ["id", "version_id", "published_run__published_run_id"]
autocomplete_fields = ["published_run", "saved_run", "changed_by"]


class PublishedRunVersionInline(admin.TabularInline):
model = PublishedRunVersion
extra = 0
autocomplete_fields = PublishedRunVersionAdmin.autocomplete_fields


@admin.register(PublishedRun)
class PublishedRunAdmin(admin.ModelAdmin):
list_display = [
Expand All @@ -290,6 +302,7 @@ class PublishedRunAdmin(admin.ModelAdmin):
"created_at",
"updated_at",
]
inlines = [PublishedRunVersionInline]

def view_user(self, published_run: PublishedRun):
if published_run.created_by is None:
Expand Down Expand Up @@ -425,12 +438,6 @@ def rerun_tasks(self, request, queryset):
)


@admin.register(PublishedRunVersion)
class PublishedRunVersionAdmin(admin.ModelAdmin):
search_fields = ["id", "version_id", "published_run__published_run_id"]
autocomplete_fields = ["published_run", "saved_run", "changed_by"]


class LastActiveDeltaFilter(admin.SimpleListFilter):
title = Conversation.last_active_delta.short_description
parameter_name = Conversation.last_active_delta.__name__
Expand Down

0 comments on commit c4053bc

Please sign in to comment.