Skip to main content

Djongo ORM

Project description

Solve the problem of djongo adapting to django orm

  1. Adaptation issue of decimal128 in mongo and decimalfield in django orm
from djongo_orm.fields import Decimal128Field

class TestModel(models.Model):
    decimal_field = Decimal128Field(max_digits=10, decimal_places=2)
  1. Query issue of boolean in mongo and django orm, and filter issue in rest framework

Model.py

from djongo_orm.fields import BooleanField

class TestModel(models.Model):
    boolean_field = BooleanField()

filter.py

from djongo_orm.fields import BooleanField
from django_filters import filters, filterset

class TestFilter1(filterset.FilterSet):
    boolean_field = filters.CharFilter(method='filter_boolean_field')
    def filter_boolean_field(self, queryset, name, value):
            queryset = queryset.filter(boolean_field=value)
            return queryset
    
    class Meta:
        model = TestModel
        fields = ['boolean_field']

class TestFilter2(filterset.FilterSet):
    
    class Meta:
        model = TestModel
        fields = ['__all__']
        filter_overrides = {
            BooleanField: {
                'filter_class': filters.CharFilter,
                'extra': lambda f: {},
            },
        }

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djongo_orm-1.0.4.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djongo_orm-1.0.4-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file djongo_orm-1.0.4.tar.gz.

File metadata

  • Download URL: djongo_orm-1.0.4.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.4

File hashes

Hashes for djongo_orm-1.0.4.tar.gz
Algorithm Hash digest
SHA256 bfde90d912b07667539e7e7114c9d35bcf1077d47852e7d39693de52338641fc
MD5 1e614f2be34ac0c10c912d094849a31b
BLAKE2b-256 fb42fd012879a4536e3200aa023058a84204a882a33813ddfe4726682bc52b7d

See more details on using hashes here.

File details

Details for the file djongo_orm-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: djongo_orm-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.4

File hashes

Hashes for djongo_orm-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 055cb4d8408a2a3632cce7ed4d38d9ebfbcd007188ab772ba630fdf22f024f0f
MD5 57a15dc7a6b30f9d434617721a996304
BLAKE2b-256 e2f395da2693fe43e5a40ce98adcd56cf0927dde3d2896117718c685c677d6d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page