Skip to content

Conversation

@dbogar89
Copy link

Problem

Django 5.1 introduced a breaking change in FileField.pre_save() that raises a FieldError when trying to save a file without a name attribute:
https://docs.djangoproject.com/en/5.2/releases/5.1/#miscellaneous

This caused S3FileField to fail with the error "str has no attribute .name" because the existing save_form_data method converts S3PlaceholderFile objects to strings before passing them to the parent class.

Solution

Modified save_form_data to handle S3PlaceholderFile objects by directly setting the field attribute using setattr, bypassing Django's FileField validation while maintaining the same behaviour of storing the filename as a string in the database.

@dbogar89
Copy link
Author

Did you get the chance to look at this @brianhelba?

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.

1 participant