Skip to content

Commit

Permalink
more admin search_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Sep 19, 2023
1 parent b6678c2 commit a1da6a9
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions bots/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,21 @@ class Media:
class BotIntegrationAdmin(admin.ModelAdmin):
search_fields = [
"name",
"billing_account_uid",
"user_language",
"fb_page_id",
"fb_page_name",
"fb_page_access_token",
"ig_account_id",
"ig_username",
"fb_page_id",
"wa_phone_number",
"wa_phone_number_id",
"slack_team_id",
"slack_team_name",
"slack_channel_id",
"billing_account_uid",
"slack_channel_name",
"slack_channel_hook_url",
"slack_access_token",
]
list_display = [
"name",
Expand Down Expand Up @@ -343,7 +352,17 @@ class ConversationAdmin(admin.ModelAdmin):
list_filter = ["bot_integration", "created_at", LastActiveDeltaFilter]
autocomplete_fields = ["bot_integration"]
search_fields = [
"fb_page_id",
"fb_page_name",
"fb_page_access_token",
"ig_account_id",
"ig_username",
"wa_phone_number",
"slack_user_id",
"slack_team_id",
"slack_user_name",
"slack_channel_id",
"slack_channel_name",
] + [f"bot_integration__{field}" for field in BotIntegrationAdmin.search_fields]
actions = [export_to_csv, export_to_excel]

Expand Down Expand Up @@ -395,10 +414,11 @@ class MessageAdmin(admin.ModelAdmin):
"created_at",
]
search_fields = [
"analysis_result",
"role",
"content",
"display_content",
"platform_msg_id",
"analysis_result",
] + [f"conversation__{field}" for field in ConversationAdmin.search_fields]
list_display = [
"__str__",
Expand Down

0 comments on commit a1da6a9

Please sign in to comment.