Skip to content

Conversation

@davegaeddert
Copy link
Member

Initial implementation of plain.s3 with:

  • S3File model for storing file metadata (key, filename, content_type, byte_size)
  • S3FileField for linking files to user models via ForeignKey
  • Presigned URL generation for direct browser-to-S3 uploads
  • Presigned download URLs with configurable expiration
  • boto3-based storage client supporting S3, Cloudflare R2, MinIO
  • Admin viewset for managing files
  • Settings for bucket, credentials, endpoint URL, ACL, and upload prefix

claude and others added 11 commits December 13, 2025 23:49
Initial implementation of plain.s3 with:
- S3File model for storing file metadata (key, filename, content_type, byte_size)
- S3FileField for linking files to user models via ForeignKey
- Presigned URL generation for direct browser-to-S3 uploads
- Presigned download URLs with configurable expiration
- boto3-based storage client supporting S3, Cloudflare R2, MinIO
- Admin viewset for managing files
- Settings for bucket, credentials, endpoint URL, ACL, and upload prefix
…ttings

- S3FileField now requires bucket parameter and accepts key_prefix and acl
- Move bucket, key_prefix, acl from global settings to per-field configuration
- Global settings now only contain connection credentials (S3_ACCESS_KEY_ID,
  S3_SECRET_ACCESS_KEY, S3_REGION, S3_ENDPOINT_URL)
- Add create_presigned_upload() method to S3FileField for convenient uploads
- Store bucket on S3File model for download_url() and delete() operations
- Update README with per-field configuration examples
- Empty __init__.py (no comments needed)
- Remove unused mypy_boto3_s3 type stub import from storage.py
- Fix README to use class-based APIView instead of @api.route decorator
- Remove unused TYPE_CHECKING import from fields.py
- Add S3File.upload() for server-side file uploads
- Add S3FileField.upload() method on model field
- Add upload_object() to storage module
- Add S3FileField form field in forms.py for use with Plain forms
- Update README with both standard and presigned upload flows
Removed standalone storage.py and moved S3 client initialization
directly into models.py as a private function. This simplifies
the package structure since storage utilities aren't needed
outside the model context.
The S3FileField model field now returns the appropriate S3FileField
form field in ModelForms, automatically passing through the bucket,
key_prefix, and acl configuration.
- formfield() now passes arguments directly instead of via dict
- clean() override matches parent FileField signature with type ignore
- delete() returns proper tuple type from parent
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