Skip to content
Snippets Groups Projects
Verified Commit 54880b5d authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Autorenaming, changed deps to caosdb

parent a97f0d5c
No related branches found
No related tags found
No related merge requests found
Showing
with 25 additions and 15 deletions
from django import template
from djongo.models.fields import ArrayFormField
from djaosdb.models.fields import ArrayFormField
register = template.Library()
......
from dataclasses import dataclass
from typing import Sequence, Any
djongo_access_url = 'https://nesdis.github.io/djongo/sponsor/'
djaosdb_access_url = 'https://nesdis.github.io/djaosdb/sponsor/'
_printed_features = set()
......@@ -38,7 +38,7 @@ class MigrationError(Exception):
def print_warn(feature=None, message=None):
if feature not in _printed_features:
message = ((message or f'This version of djongo does not support "{feature}" fully. ')
+ f'Visit {djongo_access_url}')
message = ((message or f'This version of djaosdb does not support "{feature}" fully. ')
+ f'Visit {djaosdb_access_url}')
print(message)
_printed_features.add(feature)
\ No newline at end of file
......@@ -3,7 +3,7 @@ from django.db.backends.base.features import BaseDatabaseFeatures
class DatabaseFeatures(BaseDatabaseFeatures):
supports_transactions = False
# djongo doesn't seem to support this currently
# djaosdb doesn't seem to support this currently
has_bulk_insert = True
has_native_uuid_field = True
supports_timezones = False
......
......@@ -30,9 +30,9 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
'number': 'DecimalField',
'string': 'CharField',
'boolean': 'BooleanField',
'object': 'djongo.models.DictField',
'array': 'djongo.models.ListField',
'oid': 'djongo.models.ObjectIdField',
'object': 'djaosdb.models.DictField',
'array': 'djaosdb.models.ListField',
'oid': 'djaosdb.models.ObjectIdField',
'date': 'DateTimeField'
}
......
File moved
"""
The standard way of using djongo is to import models.py
The standard way of using djaosdb is to import models.py
in place of Django's standard models module.
Djongo Fields is where custom fields for working with
......@@ -20,7 +20,7 @@ import typing
from bson import ObjectId
from django import forms
from django.core.exceptions import ValidationError
from django.db import connections as pymongo_connections
from django.db import connections as caosdb_connections
from django.db import router, connections, transaction
from django.db.models import (
Manager, Model, Field, AutoField,
......@@ -32,7 +32,7 @@ from django.utils.functional import cached_property
from django.utils.html import format_html_join, format_html
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
from djongo.exceptions import NotSupportedError, print_warn
from djaosdb.exceptions import NotSupportedError, print_warn
django_major = int(version.get_version().split('.')[0])
......@@ -60,7 +60,7 @@ class DjongoManager(Manager):
This modified manager allows to issue Mongo functions by prefixing
them with 'mongo_'.
This module allows methods to be passed directly to pymongo.
This module allows methods to be passed directly to caosdb.
"""
def __getattr__(self, name):
......@@ -72,7 +72,7 @@ class DjongoManager(Manager):
@property
def _client(self):
return (pymongo_connections[self.db]
return (caosdb_connections[self.db]
.cursor()
.db_conn[self.model._meta.db_table])
......@@ -130,7 +130,7 @@ class ModelField(MongoField):
if field.db_index:
print_warn('Embedded field index')
raise NotSupportedError(
f'This version of djongo does not support indexes on embedded fields'
f'This version of djaosdb does not support indexes on embedded fields'
)
def _value_thru_fields(self,
......
# This version of djaosdb does not support indexes
......@@ -10,7 +10,7 @@ except ImportError:
def __init__(self, *args, **kwargs):
warnings.warn(
'"jsoneditor" module not available, to enable json mode '
'please run: "pip install djongo[json]"', stacklevel=2)
'please run: "pip install djaosdb[json]"', stacklevel=2)
models.TextField.__init__(self, *args, **kwargs)
......
File moved
File moved
File moved
from djongo.exceptions import NotSupportedError, print_warn
from djaosdb.exceptions import NotSupportedError, print_warn
print_warn('aggregation')
from djaosdb.exceptions import NotSupportedError
from djaosdb import djaosdb_access_url
print(f'This version of djaosdb does not support constraints. Visit {djaosdb_access_url}')
raise NotSupportedError('constraints')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment