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):
    boolean_field = filters.CharFilter(field_name='boolean_field')
    
    class Meta:
        model = TestModel
        fields = ['boolean_field']
        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.2.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.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: djongo_orm-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 dd02c6d82f27c55bde552fb62e10db12acc5951ce2a12adac4ee63db557a2de7
MD5 c5248881110b11a9cc57c1e0f7e87621
BLAKE2b-256 67fa879e06512d5fd55d11bdaa9260cb818ea63aca55ce8f390c925bfe4abaa7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: djongo_orm-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c7ff127abb7da8d775aa87bbc9c74cdc6f5b8819f51ef8978b33cf802b592091
MD5 7490ec186a7d8d005fedd0d79480d516
BLAKE2b-256 53eb989ecbde275060dbb28ae87c0b0aa1834f0292ea12021dc109a62a501895

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