Skip to content

Interruptible uploads - #231

Merged
paigewilliams merged 16 commits into
developfrom
interruptible-uploads
Feb 2, 2026
Merged

Interruptible uploads#231
paigewilliams merged 16 commits into
developfrom
interruptible-uploads

Conversation

@paigewilliams

@paigewilliams paigewilliams commented Jan 30, 2026

Copy link
Copy Markdown
Collaborator

PR against the develop branch!

Part 1 of allowing for interruptible/resumable uploads for Media in the Admin panel. Part 2 is in the django-resumable-async-upload repo.

Description

Uses the django-resumable-async-upload package to allow for uploads of media files to be interruptible. Details on how that works are in that packages repo.

The package is used in TEKDB in the following ways:

  • For Media records, uses the AsyncFileField model instead of the FileField
  • For MediaBulkUploads admin form, uses the FormResumableFileField to allow for resumable uploads.
  • Allows for a max_files to be passed to the AsyncFileField to determine how many files can be uploaded to a file input

To do:

  • Once django-resumable-async-upload package is published, use published package. Ensure tests pass in GH action once that is complete.
  • Make a migration to use AsyncFileField
  • Maybe: schedule a cron job that deletes chunks that runs every 24 (?) , 48 (?) hours. These chunks would exist in the case that an upload partially completes and the user does not try again to upload the file. This should come in a follow up PR.

Links

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates the django-resumable-async-upload package to support interruptible/resumable media uploads in the admin, focusing on Media records and bulk media uploads.

Changes:

  • Add django-resumable-async-upload as a dependency and configure it in INSTALLED_APPS, URL routing, and project-level settings (e.g., admin resumable config).
  • Switch Media.mediafile from FileField to AsyncFileField and update the bulk media upload form/admin logic to work with resumable uploads (using FormResumableMultipleFileField and ResumableAdminWidget and saving via cleaned file path lists).
  • Update admin tests and supporting widgets/forms/migrations to align with the new resumable upload workflow and remove the legacy thumbnail file input widget.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
TEKDB/requirements.txt Adds django-resumable-async-upload to the Python dependencies and keeps tooling entries consistent.
TEKDB/TEKDB/widgets.py Removes the legacy ThumbnailFileInput widget now superseded by resumable upload widgets.
TEKDB/TEKDB/urls.py Exposes the django_resumable_async_upload URLs under /django_resumable_async_upload/ for resumable upload endpoints.
TEKDB/TEKDB/tests/test_admin.py Adjusts media bulk upload admin tests to post JSON-encoded file path lists and assert expected Media creation and thumbnail output.
TEKDB/TEKDB/settings.py Registers django_resumable_async_upload in INSTALLED_APPS and configures admin resumable upload options (thumbnails, simultaneous uploads, chunk folder).
TEKDB/TEKDB/models.py Changes Media.mediafile to AsyncFileField with max_files=1 while preserving existing model semantics.
TEKDB/TEKDB/migrations/0026_alter_media_mediafile_and_more.py Migrates the mediafile field to AsyncFileField and bumps the recorded default for MediaBulkUpload.mediabulkname.
TEKDB/TEKDB/forms.py Replaces the custom multi-file field with FormResumableMultipleFileField and ResumableAdminWidget for bulk media uploads.
TEKDB/TEKDB/admin.py Updates MediaBulkUploadAdmin.save_model to consume lists of uploaded file paths, infer media type by filename, create Media instances, and maintain related event links.
TEKDB/Dockerfile Documents that editable packages are installed at runtime, clarifying how dependencies like the resumable upload package are handled in containers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread TEKDB/TEKDB/settings.py
Comment on lines +350 to +353
# Django Resumable Async Upload settings
ADMIN_RESUMABLE_SHOW_THUMB = True
ADMIN_SIMULTANEOUS_UPLOADS = 1
ADMIN_RESUMABLE_CHUNK_FOLDER = "resumable_chunks"

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description states that OrphanedFileCleanupMiddleware is used and that the Media and MediaBulkUpload admin forms use AsyncFileCleanupMixin, but I don’t see that middleware added to MIDDLEWARE or the mixin applied to the relevant admin classes; as written, resumable uploads may leave orphaned files that are never cleaned up. Please either wire up the middleware/mixins as described or update the PR description (and any related docs) to match the actual behavior in this change set.

Copilot uses AI. Check for mistakes.

@pollardld pollardld left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most excellent!

@paigewilliams
paigewilliams merged commit 8a17fb2 into develop Feb 2, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants