Skip to content

Admin form UI improvements and multi file upload support - #1

Merged
paigewilliams merged 58 commits into
mainfrom
show-progress
Jan 30, 2026
Merged

Admin form UI improvements and multi file upload support #1
paigewilliams merged 58 commits into
mainfrom
show-progress

Conversation

@paigewilliams

@paigewilliams paigewilliams commented Jan 26, 2026

Copy link
Copy Markdown

Adds the following features to the package

Admin form UI changes:

  • Shows a progress bar while upload is in progress
  • Shows a cancel all button while uploads are in progress to stop all uploads
  • Shows a pause/resume all button while uploads in progress to pause/resume all uploads
  • Adds a remove button for each file in an upload
  • Hides the input after a file is uploaded. User must delete all files to re show the input

Supports Multi-file uploads

  • adds a field called FormResumableMultipleFileField that handles sending multiple files in a list
  • Consumers of the package can manage this by in the save_model method, doing the following:
def save_model(): 
 uploaded_file_paths = form.cleaned_data.get("files") # whatever is the name of the field using FormResumableMultipleFileField

 if uploaded_file_paths and isinstance(uploaded_file_paths, list):
   for uploaded_file_path in uploaded_file_paths:
     ... 

Config changes

  • Adds a max_files param for AsyncFileField to allow for configuration of how many files can be uploaded to a file input. Defaults to undefined, which is unlimited.

Storages changes

  • adds path for upgrading to Django 5+ which deprecates the DEFAULT_FILE_STORAGE in favor of storages while maintaining backwards compatibility

Testing

  • Adds selenium tests for pause, resume, cancel behavior
  • Adds testing for storage change

Screenshots

Screenshot 2026-01-26 at 3 12 32 PM Screenshot 2026-01-26 at 3 13 06 PM Screenshot 2026-01-26 at 3 13 34 PM

@paigewilliams paigewilliams changed the title Admin form UI improvements and clean up middleware Admin form UI improvements and multi file upload support Jan 28, 2026
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run tests

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I tried to get selenium tests to work and didnt seem like worth the effort. If time allows, it might be worth looking into using something like playwright instead considering they have better docs on how to run in a GH action https://playwright.dev/python/docs/ci-intro

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

copilot was EXTREMELY helpful in migrating to playwright! wooooo

if self.chunk_storage_name:
# If a specific storage backend is configured, use it
if storages:
# Django 4.2+ - check if it's a STORAGES key or class path

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Changes in this file are in the effort of resolving the following error, while maintaining support for older versions of django

RemovedInDjango51Warning: django.core.files.storage.get_storage_class is deprecated in favor of using django.core.files.storage.storages

Comment thread README.md
@@ -0,0 +1,55 @@
# django-resumable-async-upload

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

markdown > rst

Comment thread admin_async_upload/views.py Outdated
return JsonResponse({'status': 'success', 'message': 'File removed'})
except Exception as e:
logger.error(f"Failed to delete file: {str(e)}")
return JsonResponse({'error': f"Failed to delete file: {file_path} "}, status=500)

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.

Okay to ship without resolving this:

If an there is an error during json.loads() on line 50, then file_path will raise an error here bc it hasn't been defined.

A potential fix is to declare file_path before try statement file_path = None.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

good catch! I made the change per your suggestion.

@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.

This is quality open source software!

@paigewilliams
paigewilliams merged commit 336ff3e into main Jan 30, 2026
2 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