From fd22fe26b7a255712aabf8e56c5d6b74eab01c37 Mon Sep 17 00:00:00 2001 From: timgl Date: Thu, 23 Nov 2023 13:31:25 +0000 Subject: [PATCH] fix: Add Decimal as a type --- posthog/admin.py | 35 +++++++++++++++++++++++++++++-- posthog/warehouse/models/table.py | 1 + 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/posthog/admin.py b/posthog/admin.py index 2c0d26a1b01fb..7161cbaf27081 100644 --- a/posthog/admin.py +++ b/posthog/admin.py @@ -33,8 +33,6 @@ ) from posthog.warehouse.models import DataWarehouseTable -admin.site.register(DataWarehouseTable) - class DashboardTileInline(admin.TabularInline): extra = 0 @@ -81,6 +79,39 @@ def organization_link(self, dashboard: Dashboard): ) +@admin.register(DataWarehouseTable) +class DataWarehouseTableAdmin(admin.ModelAdmin): + list_display = ( + "id", + "name", + "format", + "url_pattern", + "team_link", + "organization_link", + "created_at", + "created_by", + ) + list_display_links = ("id", "name") + list_select_related = ("team", "team__organization") + search_fields = ("id", "name", "team__name", "team__organization__name") + autocomplete_fields = ("team", "created_by") + ordering = ("-created_at",) + + def team_link(self, dashboard: Dashboard): + return format_html( + '{}', + dashboard.team.pk, + dashboard.team.name, + ) + + def organization_link(self, dashboard: Dashboard): + return format_html( + '{}', + dashboard.team.organization.pk, + dashboard.team.organization.name, + ) + + @admin.register(Text) class TextAdmin(admin.ModelAdmin): autocomplete_fields = ("created_by", "last_modified_by", "team") diff --git a/posthog/warehouse/models/table.py b/posthog/warehouse/models/table.py index 2acf4fb1faf9b..93e6a20e890f2 100644 --- a/posthog/warehouse/models/table.py +++ b/posthog/warehouse/models/table.py @@ -43,6 +43,7 @@ "Array": StringArrayDatabaseField, "Map": StringJSONDatabaseField, "Bool": BooleanDatabaseField, + "Decimal": IntegerDatabaseField, } ExtractErrors = {