Djongo ORM
Project description
Solve the problem of djongo adapting to django orm
- 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)
- 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.3.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djongo_orm-1.0.3.tar.gz.
File metadata
- Download URL: djongo_orm-1.0.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
819edb94a07a241bce961fda79aee551487ae9d3b8a89fff8c1bb464892e4b68
|
|
| MD5 |
17194974d37adba104ac2858668c66d6
|
|
| BLAKE2b-256 |
c380cc31958088b1d60dd22295c757f083c886bebfb871c372f52decb9e017e8
|
File details
Details for the file djongo_orm-1.0.3-py3-none-any.whl.
File metadata
- Download URL: djongo_orm-1.0.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
323f1eb86e592036edb90b84b46d23e6fe4cd1835a7b60ec264b7635b29b266d
|
|
| MD5 |
ecc13adb9df95ca9233557d130134c3e
|
|
| BLAKE2b-256 |
c5e8addc330e77c823924cd359066c5434b269b6ad9a1b3b1ad6a7a2d11a61a3
|