Skip to content

Commit

Permalink
feat: add update page views task as admin action
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna committed Feb 6, 2024
1 parent 715c007 commit b0dda26
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bd_api/apps/api/v1/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
)
from bd_api.apps.api.v1.tasks import (
rebuild_search_index_task,
update_page_views_task,
update_search_index_task,
update_table_metadata_task,
)
Expand Down Expand Up @@ -240,6 +241,14 @@ class UpdateInline(admin.StackedInline):
################################################################################


def update_page_views(modeladmin: ModelAdmin, request: HttpRequest, queryset: QuerySet):
"""Update the page views counter of all datasets and tables"""
update_page_views_task()


update_page_views.short_description = "Atualizar metadados de visualizações"


def update_table_metadata(
modeladmin: ModelAdmin, request: HttpRequest, queryset: QuerySet
):
Expand Down Expand Up @@ -451,6 +460,7 @@ class DatasetAdmin(OrderedInlineModelAdminMixin, TabbedTranslationAdmin):
reorder_tables,
reset_table_order,
update_table_metadata,
update_page_views,
update_search_index,
rebuild_search_index,
]
Expand Down Expand Up @@ -507,6 +517,7 @@ class TableAdmin(OrderedInlineModelAdminMixin, TabbedTranslationAdmin):
reorder_columns,
reset_column_order,
update_table_metadata,
update_page_views,
]
inlines = [
ColumnInline,
Expand Down

0 comments on commit b0dda26

Please sign in to comment.