Skip to main content

django-extended-models

GitHub license

django-extended-models is a Django utility package that provides mixins and models with extended functionalities.

Installation

Install the package using Poetry:

poetry add django-extended-models

Features

utils.py

__set_default_values

The function sets default values for fields in a model if they are not provided.

from django_extended_models.utils import __set_default_values

# Example usage:
model = ...
fields = ...

dictionary, fields = __set_default_values(model, fields)

model_to_dict

Converts a Django model object into a dictionary, recursively including related model objects up to a specified depth.

from django_extended_models.utils import model_to_dict

# Example usage:
object = ...
fields = ...

dictionary = model_to_dict(object, fields=fields)

mixins.py

ToDictMixin

Provides a method to_dict that converts a model instance to a dictionary.

from django_extended_models.mixins import ToDictMixin

# Example usage:
class MyModel(ToDictMixin):
    pass

instance = MyModel()
dictionary = instance.to_dict()

models.py

BaseModel

A base model that includes the ToDictMixin.

from django_extended_models.models import BaseModel

# Example usage:
class MyModel(BaseModel):
    pass

License

This project is licensed under the MIT License - see the LICENSE file for details.

Release files for django-extended-models 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-extended-models 0.1.0
File Size Uploaded
django_extended_models-0.1.0.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-extended-models 0.1.0
File Interpreter ABI Platform
django_extended_models-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / django_extended_models-0.1.0.tar.gz

Download URL django_extended_models-0.1.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
396b40e17d30007fdb9ca1a206c4edf4eaa13fe22b0c2acfda4c0bc499ea453e
BLAKE2b-256 checksum
How to use checksums
ef6e3f828254a920061ea6345118bac9ea040205d7ba50b21979a144bb6c6183
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/6.5.0-15-generic

Release files / django_extended_models-0.1.0-py3-none-any.whl

Download URL django_extended_models-0.1.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6721670f5150354f6528a6310a8b1a3aed193782a29a8a096df7ab87cd89a5f7
BLAKE2b-256 checksum
How to use checksums
dd90800b36a963b3d24c1175a9d382fdb8c0d1b1f98ec211344e626814c5a077
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/6.5.0-15-generic

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page