[widgets] Add tasks
All checks were successful
build & deploy / test (push) Successful in 1m51s
build & deploy / deploy (push) Successful in 23s

This commit is contained in:
2026-03-31 16:45:10 -04:00
parent 9a8d5a7608
commit 192d0c489b
2 changed files with 16 additions and 0 deletions

View File

@ -32,6 +32,11 @@ urlpatterns = [
views.EmbeddableTopFoodsWidget.as_view(),
name="embeddable-top-foods",
),
path(
"widget/top-tasks/<str:period>/<int:user_id>/",
views.EmbeddableTopTasksWidget.as_view(),
name="embeddable-top-tasks",
),
path(
"manual/lookup/",
views.ManualScrobbleView.as_view(),

View File

@ -1224,3 +1224,14 @@ class EmbeddableTopFoodsWidget(BaseEmbeddableWidget):
from foods.models import Food
return super().get_items(user, start_date, Food)
class EmbeddableTopTasksWidget(BaseEmbeddableWidget):
media_type = "Tasks"
count_label = "sessions"
no_data_message = "No tasks logged"
def get_items(self, user, start_date):
from tasks.models import Task
return super().get_items(user, start_date, Task)