feat: bulk admin actions for Media.skip - #1570
Conversation
Managing large libraries through the Django admin required editing every media item individually to toggle 'skip' or 'can download' (meeb#493). Add the standard admin bulk actions for exactly the two fields requested there: - Set / unset 'skip' — also sets manual_skip to match, so a bulk un-skip is not immediately re-skipped by the filtering logic, and a bulk skip is treated as the operator's explicit decision - Set / unset 'can download' Also adds list_filter for can_download/skip/downloaded so the items to bulk-edit can actually be narrowed down first. Uses queryset.update() so a bulk action on thousands of rows is a single UPDATE, not thousands of model saves. Tests cover both action pairs and the action registration. Fixes meeb#493
I don't understand the question. |
|
As in, is just setting |
|
The That is eventually triggered for every Is this sufficient, or do you believe a |
|
Good question re: signals — since |
|
I'm fine with it waiting for an Indexing to trigger any events, just checking. |
tcely
left a comment
There was a problem hiding this comment.
Please implement a save_media task per changed item and add a setting that enables queuing those tasks. By default, the tasks should not be queued.
Adds SAVE_MEDIA_AFTER_BULK_ACTION (env: TUBESYNC_SAVE_MEDIA_AFTER_BULK_ACTION, default False). When enabled, each admin bulk action queues a save_media task per changed item so flags are re-evaluated without waiting for the next source edit or indexing run. When disabled (the default) behaviour is unchanged: re-evaluation happens on the next source edit/index pass. Requested by tcely in review.
|
Done in be4313b — implemented exactly as requested:
|
4059c19 to
2dd4b88
Compare
Media.skip
Problem
Managing a large library through the Django admin requires editing every media item individually to toggle Skip or Can download — the exact pain point in #493, where bulk-editing those two flags was requested ("A real time saver would be to expose actions such as enabling/disabling Skip or Can download").
Change
Adds the standard Django admin bulk actions to
MediaAdmin, scoped to exactly the two fields requested:manual_skipto match, so a bulk un-skip isn't immediately re-skipped by the filtering logic, and a bulk skip is recorded as the operator's explicit decision.Also adds
list_filterforcan_download/skip/downloaded, so the rows to bulk-edit can be narrowed down first (without a filter the actions are much less useful on big libraries).Implementation uses
queryset.update(), so a bulk action across thousands of rows is a singleUPDATEstatement rather than thousands of model saves.Testing
sync/tests/test_admin.pycovers both action pairs end-to-end against real model rows (including themanual_skipcoupling) plus action registration.manage.py test— 54 tests, OK.Fixes #493