File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
import contextlib
2
+ import os
2
3
3
4
from django .core .exceptions import ImproperlyConfigured
4
5
from django .db .backends .base .base import BaseDatabaseWrapper
5
6
from pymongo .collection import Collection
7
+ from pymongo .driver_info import DriverInfo
6
8
from pymongo .mongo_client import MongoClient
7
9
10
+ from . import __version__ as django_mongodb_backend_version
8
11
from . import dbapi as Database
9
12
from .client import DatabaseClient
10
13
from .creation import DatabaseCreation
@@ -170,7 +173,12 @@ def get_connection_params(self):
170
173
}
171
174
172
175
def get_new_connection (self , conn_params ):
173
- return MongoClient (** conn_params )
176
+ return MongoClient (** conn_params , driver = self ._driver_info ())
177
+
178
+ def _driver_info (self ):
179
+ if not os .environ .get ("RUNNING_DJANGOS_TEST_SUITE" ):
180
+ return DriverInfo ("django-mongodb-backend" , django_mongodb_backend_version )
181
+ return None
174
182
175
183
def _commit (self ):
176
184
pass
You can’t perform that action at this time.
0 commit comments