Django-alt

Latest version: v0.74

Safety actively analyzes 681812 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

0.74

- Fixed field name retrieval when a `source` parameter is used in a serializer
field definition.
- Shortcut `required_all` backported from dev-1.0 branch.
- `dot_dict` module backported from dev-1.0 branch.

0.73

- `view_prototype` now doesn't return a 404 when a `QuerySet.get` fails with
`ObjectDoesNotExist` with HTTP PUT, instead creating a new object from request data.

0.71

- Endpoint handlers now accept `HttpResponse` subclass as a return parameter.

0.70

Breaking changes:

- `post_can` permission callable now includes `url` dict as its second parameter.
- before: `lambda request, queryset, attrs: True`.
- after: `lambda request, url, queryset, attrs: True`.
- `did_delete` lifecycle hook doesn't accept the `attrs` parameter anymore.

Updates:
- `clean_` and `field_` `Validator` functions are now passed an optional `attrs` argument.
- `on_put` endpoint handler implementation.
- `ValidatedManager` introduces `create_many`, `update` and `delete` functions. These work as they would in `Manager`s but
use a given `Validator` instance to validate data beforehand.
- `Validator` object now includes a `request` and `permission_test` parameters that are
automatically passed in by endpoints/serializers.
- Code is now compliant and works with Django 1.11.
- Added new shortcuts:
- `coald` – a deferred variation of the null-coalescing operator.
- `is_iterable` – shortcut for checking if object is an iterable (strings are excluded).
- `prohibited` – shortcut for raising a validation error about an existing prohibited field.
- `prohibited_any` – shortcut for raising a validation error when any of the given fields exist in the container.
- `required` – shortcut for raising a validation error about a missing required field..
- `valid_if` – asserts that a predicate is correct, raising a `serializers.ValidationError` otherwise.
- `ensures` – (alias of `valid_if`) used in Design by Contract methodology to denote that a callable
asserts that a given condition is true before executing any code.
- `expects` – (alias of `valid_if`) used in Design by Contract methodology to denote that a callable
asserts that a given condition is true after its code block is executed.
- Added `no_save` parameter to `ValidatedManager.__init__` that skips the actual `ObjectManager` calls if defined.
- Some new error messages introduced and others made more user friendly.
- Documentation updated to include more relevant info and examples.

0.61

- Introduced `ValidatedManager` that allows validate data before
creating a new model instance.
- Introduced wildcard cleaners: similarly to wildcard field validators, cleaners are
are `clean_<field_name>` functions that are expected to return a cleaned value
for the field. The return value is then set on the `attrs` `dict`.
- Shortcut `coal_first` renamed to a more memorable `first_defined`.
- Improved test coverage.

0.60

- Improved documentation (`readme.md`, `recipes.md`), added `indepth.md`.
- Introduced wildcard validators: ability to defined arbitrary functions
to validate individual fields or all attributes collectively. More information
on this in `indepth.md`.
- Introduced automatic query parameter casting (e.g. where possible `"1"` -> `1`,
`"true"` -> `True`, etc.). This feature can be turned off by adding
`no_url_param_casting` in the config dict on the endpoint.
- Broadened `pre_permission` and `post_permission` definition to include
absolute values instead of callables:
- `True` -> permission always granted,
- `False` -> permission never granted,
- `None` -> no permission needed (`True` <=> `None`, the distinction is only semantic).
- Added `ValidatedModelListSerializer`.
- Added `coal_first` shortcut function. It finds the first argument
that is not `None` and doesn't raise a `KeyError`.
- Added `compose_and` shortcut. It composes an iterable of callables
with identical signatures and asserts universal quantification for their results.
- Added `pre_logged_in` permission shortcut.

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.