Django-ninja

Latest version: v1.3.0

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

Scan your dependencies

Page 1 of 7

1.3.0

This version brings few enahcments

1) Serialisation context now has request and response code

Python
class SchemaWithCustomSerializer(Schema):
test1: str
test2: str

model_serializer(mode="wrap")
def ser_model(self, handler, info):
request = info.context["request"] !!!
response_status = info.context["response_status"] !!!
return handler(self)


2) With `PatchDict` you can quickly define schemas with all optional fields and use it as dict with ONLY fields that were passed in request payload (aka patch requests)


Python
from ninja import PatchDict

class SomeSchema(Schema):
name: str
description: str
due_date: date
Note all fields a required


api.patch("/patch")
def modify_data(request, payload: PatchDict[SomeSchema]):
payload ! <--- payload is a type of dict and contains only keys that were passed in request body (validated with SomeSchema)

for attr, value in payload.items():
setattr(obj, attr, value)

obj.save()


All changes
* Support import string in router.add_router by martinsvoboda in https://github.com/vitalik/django-ninja/pull/1256
* Add default headers for NinjaClientBase instance by c4ffein in https://github.com/vitalik/django-ninja/pull/1259
* Fix issue when consulting request attributes while using mocked request by acuriel in https://github.com/vitalik/django-ninja/pull/1244
* Allow generic filter types by eugenenelou in https://github.com/vitalik/django-ninja/pull/1212
* DRF-style data property for responses in tests by c4ffein in https://github.com/vitalik/django-ninja/pull/1260
* Pass serialisation context to model_dump (fixes 1233) by scorpp in https://github.com/vitalik/django-ninja/pull/1261
* PatchDict util by vitalik in https://github.com/vitalik/django-ninja/pull/1262

New Contributors
* martinsvoboda made their first contribution in https://github.com/vitalik/django-ninja/pull/1256
* acuriel made their first contribution in https://github.com/vitalik/django-ninja/pull/1244
* eugenenelou made their first contribution in https://github.com/vitalik/django-ninja/pull/1212
* scorpp made their first contribution in https://github.com/vitalik/django-ninja/pull/1261

**Full Changelog**: https://github.com/vitalik/django-ninja/compare/v1.2.2...v1.3.0

1.2.2

What's Changed
* Fix unchanging field bug when validate assignment true by austinpgraham in https://github.com/vitalik/django-ninja/pull/1232


**Full Changelog**: https://github.com/vitalik/django-ninja/compare/v1.2.1...v1.2.2

1.2.1

Fixed throttling in async mode

1.2.0

What's new

with most notable

- **Async Pagination** support by jamesrkiger
- and [Throttling](https://django-ninja.dev/guides/throttling/)

All changes:
* Throttling by vitalik in https://github.com/vitalik/django-ninja/pull/1208
* Async Pagination support by jamesrkiger in https://github.com/vitalik/django-ninja/pull/1030
* Fix ForwardRef._evaluate() missing 1 required keyword-only argument on python 3.12.4 by Object905 in https://github.com/vitalik/django-ninja/pull/1204
* fix: validation of nullable fields with a non-null default value by julienc91 in https://github.com/vitalik/django-ninja/pull/1181
* Add ORM support for SmallAutoField by jlost in https://github.com/vitalik/django-ninja/pull/1185
* Expose django_auth_superuser through __all__ by mostthingsweb in https://github.com/vitalik/django-ninja/pull/992
* Fix dict when validate assignment true by austinpgraham in https://github.com/vitalik/django-ninja/pull/1024
* Fix 1088 : Inconsistency in indentation by Nirmalkumar6112 in https://github.com/vitalik/django-ninja/pull/1091
* Update LimitOffsetPagination.Input schema by kajiczech in https://github.com/vitalik/django-ninja/pull/1134
* Delete setup.py by jeffwidman in https://github.com/vitalik/django-ninja/pull/1138
* chore: modernize ruff config to work with ruff >= v0.2 by afuetterer in https://github.com/vitalik/django-ninja/pull/1120
* chore: update ruff pre-commit version by afuetterer in https://github.com/vitalik/django-ninja/pull/1121
* Minor Typing Improvement for `FilterSchema` by max-muoto in https://github.com/vitalik/django-ninja/pull/1039
* Fix typing for Exception Handlers by max-muoto in https://github.com/vitalik/django-ninja/pull/1130
* Add Generic Typing for `decorate_view` to resolve Pyright Issues by max-muoto in https://github.com/vitalik/django-ninja/pull/1126
* Fix Ninja Schema Typing by max-muoto in https://github.com/vitalik/django-ninja/pull/1165


Docs
* pagination: fix comment about default class by ivoire in https://github.com/vitalik/django-ninja/pull/1034
* Fix typo by Hisham-Pak in https://github.com/vitalik/django-ninja/pull/1054
* docs(form-data): add missing slash by Zerotask in https://github.com/vitalik/django-ninja/pull/1074
* docs(file-uploads): minor adjustments by Zerotask in https://github.com/vitalik/django-ninja/pull/1075
* docs(response): add link for error responses by Zerotask in https://github.com/vitalik/django-ninja/pull/1135
* Fix TestClient name in testing docs by adriaanwm in https://github.com/vitalik/django-ninja/pull/1102
* docs(operations): minor adjustments by Zerotask in https://github.com/vitalik/django-ninja/pull/1076
* Add dark mode to ninja docs by Hisham-Pak in https://github.com/vitalik/django-ninja/pull/1056
* Docs: Adds an example to show how exclude_unset works by benjaoming in https://github.com/vitalik/django-ninja/pull/1173
* fix typo in guides/input/filtering by Moe-Hassan-123 in https://github.com/vitalik/django-ninja/pull/994
* Minor documentation tweaks by jonklo in https://github.com/vitalik/django-ninja/pull/1010
* Cleanup documentation warnings by jlucas91 in https://github.com/vitalik/django-ninja/pull/1021
* Add basic testing documentation by jlucas91 in https://github.com/vitalik/django-ninja/pull/1020
* Fix README.md test badge by jlucas91 in https://github.com/vitalik/django-ninja/pull/1018
* Update django-pydantic-create-schema.md by pradipthinkitive in https://github.com/vitalik/django-ninja/pull/1043

New Contributors
* mostthingsweb made their first contribution in https://github.com/vitalik/django-ninja/pull/992
* Moe-Hassan-123 made their first contribution in https://github.com/vitalik/django-ninja/pull/994
* jonklo made their first contribution in https://github.com/vitalik/django-ninja/pull/1010
* jlucas91 made their first contribution in https://github.com/vitalik/django-ninja/pull/1018
* austinpgraham made their first contribution in https://github.com/vitalik/django-ninja/pull/1024
* max-muoto made their first contribution in https://github.com/vitalik/django-ninja/pull/1039
* pradipthinkitive made their first contribution in https://github.com/vitalik/django-ninja/pull/1043
* Hisham-Pak made their first contribution in https://github.com/vitalik/django-ninja/pull/1054
* Zerotask made their first contribution in https://github.com/vitalik/django-ninja/pull/1074
* jeffwidman made their first contribution in https://github.com/vitalik/django-ninja/pull/1136
* Nirmalkumar6112 made their first contribution in https://github.com/vitalik/django-ninja/pull/1091
* kajiczech made their first contribution in https://github.com/vitalik/django-ninja/pull/1134
* afuetterer made their first contribution in https://github.com/vitalik/django-ninja/pull/1120
* adriaanwm made their first contribution in https://github.com/vitalik/django-ninja/pull/1102
* benjaoming made their first contribution in https://github.com/vitalik/django-ninja/pull/1173
* Object905 made their first contribution in https://github.com/vitalik/django-ninja/pull/1204
* julienc91 made their first contribution in https://github.com/vitalik/django-ninja/pull/1181
* jlost made their first contribution in https://github.com/vitalik/django-ninja/pull/1185

**Full Changelog**: https://github.com/vitalik/django-ninja/compare/v1.1.0...v1.2.0

1.1.0

What's Changed
* Pagination set max limit by HyoungSooo in https://github.com/vitalik/django-ninja/pull/915
* Fixed Fields not generated when Meta.fields_optional = '__all__' by vitalik in https://github.com/vitalik/django-ninja/pull/986
* Add UUID to supported fields by gokaykucuk in https://github.com/vitalik/django-ninja/pull/982
* Remove Redoc body margin by Nekidev in https://github.com/vitalik/django-ninja/pull/887
* Replace deprecated Pydantic method by scott-8 in https://github.com/vitalik/django-ninja/pull/922
* More comprehensive documentation for CSRF protection by c4ffein in https://github.com/vitalik/django-ninja/pull/906
* Git ignore coverage.xml file by adamchainz in https://github.com/vitalik/django-ninja/pull/944
* Fix pytest.mark.asyncio warning by adamchainz in https://github.com/vitalik/django-ninja/pull/943
* Use ruff to format code instead of black by jairhenrique in https://github.com/vitalik/django-ninja/pull/949
* Attribute `description` declared has type `str` but is used as type None by luca-digrazia in https://github.com/vitalik/django-ninja/pull/530
* Fix test warning by jairhenrique in https://github.com/vitalik/django-ninja/pull/951
* Drop support to unsupported python and django versions by jairhenrique in https://github.com/vitalik/django-ninja/pull/950
* test: Add django 5.0 to the test matrix by marksweb in https://github.com/vitalik/django-ninja/pull/954
* Fix mypy issues by jairhenrique in https://github.com/vitalik/django-ninja/pull/956
* Enable UP rule on ruff by jairhenrique in https://github.com/vitalik/django-ninja/pull/957
* Enable FURB rule on ruff by jairhenrique in https://github.com/vitalik/django-ninja/pull/958
* docs: remove extra backtick in api docs page by noahgorstein in https://github.com/vitalik/django-ninja/pull/964
* Enable PTH rule on ruff by jairhenrique in https://github.com/vitalik/django-ninja/pull/966
* Update ninja conf docs by jamesrkiger in https://github.com/vitalik/django-ninja/pull/972



New Contributors
* c4ffein made their first contribution in https://github.com/vitalik/django-ninja/pull/906
* adamchainz made their first contribution in https://github.com/vitalik/django-ninja/pull/944
* luca-digrazia made their first contribution in https://github.com/vitalik/django-ninja/pull/530
* Nekidev made their first contribution in https://github.com/vitalik/django-ninja/pull/887
* marksweb made their first contribution in https://github.com/vitalik/django-ninja/pull/954
* noahgorstein made their first contribution in https://github.com/vitalik/django-ninja/pull/964
* HyoungSooo made their first contribution in https://github.com/vitalik/django-ninja/pull/915
* jamesrkiger made their first contribution in https://github.com/vitalik/django-ninja/pull/972
* gokaykucuk made their first contribution in https://github.com/vitalik/django-ninja/pull/982

**Full Changelog**: https://github.com/vitalik/django-ninja/compare/v1.0.1...v1.1.0

1.0.1

Fixed `from_orm` compatibility

Page 1 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.