|
2 | 2 | from django.db.models import Index, UniqueConstraint
|
3 | 3 | from pymongo.operations import SearchIndexModel
|
4 | 4 |
|
5 |
| -from .encryption import get_encrypted_client |
| 5 | +from .encryption import get_client_encryption |
6 | 6 | from .fields import EmbeddedModelField
|
7 | 7 | from .indexes import SearchIndex
|
8 | 8 | from .query import wrap_database_errors
|
@@ -421,18 +421,16 @@ def _field_should_have_unique(self, field):
|
421 | 421 |
|
422 | 422 | def _create_collection(self, model):
|
423 | 423 | """
|
424 |
| - Create a collection or, if encryption is supported, create |
425 |
| - an encrypted client then use that to create an encrypted |
426 |
| - collection. |
| 424 | + Create a collection or encrypted collection for the model. |
427 | 425 | """
|
428 | 426 |
|
429 | 427 | if hasattr(model, "encrypted_fields_map"):
|
430 | 428 | auto_encryption_opts = self.connection.settings_dict.get("OPTIONS", {}).get(
|
431 | 429 | "auto_encryption_opts"
|
432 | 430 | )
|
433 | 431 | client = self.connection.connection
|
434 |
| - encrypted_client = get_encrypted_client(auto_encryption_opts, client) |
435 |
| - encrypted_client.create_encrypted_collection( |
| 432 | + client_encryption = get_client_encryption(auto_encryption_opts, client) |
| 433 | + client_encryption.create_encrypted_collection( |
436 | 434 | client.database,
|
437 | 435 | model._meta.db_table,
|
438 | 436 | model.encrypted_fields_map,
|
|
0 commit comments