Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ We follow [Semantic Versions](https://semver.org/).

- Replace [httpx](https://github.com/encode/httpx) with
[httpx2](https://github.com/pydantic/httpx2) in docs and tests
- Improve docs for get params Django API

## 0.8.0

Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ local = [
# A library and CLI app for rendering project templates.
# https://copier.readthedocs.io/en/latest/
"copier",
# Werkzeug is a comprehensive WSGI web application library.
# Required to use runserver_plus
# https://werkzeug.palletsprojects.com/en/stable/
"Werkzeug",
]
linters = [
# Mypy is a static type checker for Python.
Expand Down
25 changes: 22 additions & 3 deletions saritasa_s3_tools/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,25 @@ class S3FileTypeConfig(metaclass=S3FileTypeConfigMeta):
expires_in: int = 3600
success_action_status: int = 201
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
content_disposition: (
typing.Literal["attachment"] | typing.Literal["inline"]
) = "attachment"
content_disposition: typing.Literal["attachment", "inline"] = "attachment"

def get_short_description(self) -> str:
"""Get short description for config."""
allowed_types = (
", ".join(self.allowed) if self.allowed else "All types"
)
content_length_range = (
(
f"{self.content_length_range[0]}-"
f"{self.content_length_range[1]} bytes"
)
if self.content_length_range
else "Any length"
)
return (
f"*Allowed types*: {allowed_types}, "
f"*Content length range*: {content_length_range}, "
f"*Expires in*: {self.expires_in} seconds, "
f"*Success action status*: {self.success_action_status}, "
f"*Content disposition*: {self.content_disposition}"
)
4 changes: 3 additions & 1 deletion saritasa_s3_tools/django/drf_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def _get_choices(self) -> dict[str, str]:
current_choices = tuple(
(
config_name,
config_name,
configs.S3FileTypeConfig.configs[
config_name
].get_short_description(),
)
for config_name in configs.S3FileTypeConfig.configs
)
Expand Down
14 changes: 14 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading