Skip to content

Commit

Permalink
fix: Add Decimal as a type
Browse files Browse the repository at this point in the history
  • Loading branch information
timgl committed Nov 23, 2023
1 parent fc0107f commit fd22fe2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
35 changes: 33 additions & 2 deletions posthog/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
)
from posthog.warehouse.models import DataWarehouseTable

admin.site.register(DataWarehouseTable)


class DashboardTileInline(admin.TabularInline):
extra = 0
Expand Down Expand Up @@ -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(
'<a href="/admin/posthog/team/{}/change/">{}</a>',
dashboard.team.pk,
dashboard.team.name,
)

def organization_link(self, dashboard: Dashboard):
return format_html(
'<a href="/admin/posthog/organization/{}/change/">{}</a>',
dashboard.team.organization.pk,
dashboard.team.organization.name,
)


@admin.register(Text)
class TextAdmin(admin.ModelAdmin):
autocomplete_fields = ("created_by", "last_modified_by", "team")
Expand Down
1 change: 1 addition & 0 deletions posthog/warehouse/models/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"Array": StringArrayDatabaseField,
"Map": StringJSONDatabaseField,
"Bool": BooleanDatabaseField,
"Decimal": IntegerDatabaseField,
}

ExtractErrors = {
Expand Down

0 comments on commit fd22fe2

Please sign in to comment.