Skip to content

Commit

Permalink
args for get_model_dump (#780)
Browse files Browse the repository at this point in the history
* args for get_model_dump

* version: 1.23.4
  • Loading branch information
roman-right authored Nov 12, 2023
1 parent 8ae7ae0 commit bc854e7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
4 changes: 3 additions & 1 deletion beanie/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from beanie.odm.custom_types import DecimalAnnotation
from beanie.odm.custom_types.bson.binary import BsonBinary
from beanie.odm.documents import Document
from beanie.odm.enums import SortDirection
from beanie.odm.fields import (
BackLink,
DeleteRules,
Expand All @@ -31,7 +32,7 @@
from beanie.odm.utils.init import init_beanie
from beanie.odm.views import View

__version__ = "1.23.3"
__version__ = "1.23.4"
__all__ = [
# ODM
"Document",
Expand All @@ -42,6 +43,7 @@
"Indexed",
"TimeSeriesConfig",
"Granularity",
"SortDirection",
# Actions
"before_event",
"after_event",
Expand Down
6 changes: 3 additions & 3 deletions beanie/odm/utils/pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def get_config_value(model, parameter: str):
return getattr(model.Config, parameter, None)


def get_model_dump(model):
def get_model_dump(model, *args, **kwargs):
if IS_PYDANTIC_V2:
return model.model_dump()
return model.model_dump(*args, **kwargs)
else:
return model.dict()
return model.dict(*args, **kwargs)
8 changes: 8 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

Beanie project

## [1.23.4] - 2023-11-12
### Args For `get_model_dump`
- Author - [Roman Right](https://github.com/roman-right)
- PR <https://github.com/roman-right/beanie/pull/780>

[1.23.4]: https://pypi.org/project/beanie/1.23.4

## [1.23.3] - 2023-11-08
### Fix Id Notation
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "beanie"
version = "1.23.3"
version = "1.23.4"
description = "Asynchronous Python ODM for MongoDB"
readme = "README.md"
requires-python = ">=3.7,<4.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_beanie.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def test_version():
assert __version__ == "1.23.3"
assert __version__ == "1.23.4"

0 comments on commit bc854e7

Please sign in to comment.