Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nextgencontributions/django2pydantic

Django2pydantic is the most complete library for converting Django ORM models to Pydantic models
https://github.com/nextgencontributions/django2pydantic

api api-rest converter django django-orm django-orm-crud inference models pydantic pydantic-v2 rest-api restapi restful-api schema

Last synced: 30 days ago
JSON representation

Django2pydantic is the most complete library for converting Django ORM models to Pydantic models

Awesome Lists containing this project

README

        

![PyPI - License](https://img.shields.io/pypi/l/django)
![PyPI - Downloads](https://img.shields.io/pypi/dm/django2pydantic)

# Why

django2pydantic is the most complete Pydantic schemas based on Django models.

# What

django2pydantic is a library that allows to define Pydantic schemas based on Django database models.

Similar libraries:

- [Djantic](https://jordaneremieff.github.io/djantic/)
- [Django Ninja Schema](https://django-ninja.dev/guides/response/django-pydantic/)
- [Ninja Schema](https://github.com/eadwinCode/ninja-schema)

# Key features

- Supports all Django model field types
- Supports @property decorated Django model methods
- Supports all Django model relation fields:
- ForeignKey, OneToOneField, ManyToManyField
- The reverse relations of the above (ManyToOneRel, OneToOneRel, ManyToManyRel)
- Supports defining nested relations
- Provides as complete OpenAPI schema details as possible

# How to use

[See usage example here.](examples.ipynb)