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 11import contextlib
2+ import os
23
34from django .core .exceptions import ImproperlyConfigured
45from django .db .backends .base .base import BaseDatabaseWrapper
56from pymongo .collection import Collection
7+ from pymongo .driver_info import DriverInfo
68from pymongo .mongo_client import MongoClient
79
10+ from . import __version__ as django_mongodb_backend_version
811from . import dbapi as Database
912from .client import DatabaseClient
1013from .creation import DatabaseCreation
@@ -170,7 +173,12 @@ def get_connection_params(self):
170173 }
171174
172175 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
174182
175183 def _commit (self ):
176184 pass
You can’t perform that action at this time.
0 commit comments