Django-pydantic-field

Latest version: v0.3.10

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

Scan your dependencies

Page 8 of 8

0.1.5

I feel it's an overhead to define a full `Config` class in some cases, like:
python
class Config:
json_encoders = ...

field: t.List[Schema] = SchemaField(config=Config)


The convenient solution is to pass a dict config instead:
python
field: t.List[Schema] = SchemaField(config={"json_encoders": ...})

Well, it is now possible to do so.

0.1.4

I'm considering current behavior with forward references resolution as expected. I.e. field schemas should be always defined before field declaration, otherwise it's not possible to bind a schema to the field during model initialzation. Note though, that annotation should still be declared as string/typing.ForwardRef, as long as prior constraint is satisfied. Main change: now such behavior is explicitly stated with tests.

0.1.3

I tried to defer schema initialzation at a field descriptor level, but this approach did not succeeded with current migrations flow

0.1.1

Now, instead specifying explicit schema, one could write:
py3
from django.db import Model
from django_pydantic_field import SchemaField

class MyModel(models.Model):
field: list[int] = SchemaField()


The schema will be inferred at model freezing step.
Note that it's not possible to specify unresolved forward references at the moment.

0.1.0

This is the first minor release of `django-pydantic-field`, with field-level type definitions:
python
class Foo(pydantic.BaseModel):
bar: int

class MyModel(models.Model):
meta: list[Foo] = SchemaField(schema=list[Foo])


In order to support this, I had to introduce a breaking changes in field api defintion:
all `Pydantic`-prefixed classes should be used without this prefix, e.g:

python
PydanticSchemaField -> SchemaField
PydanticSchemaRenderer -> SchemaRenderer
...

0.0.9

Page 8 of 8

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.