File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -427,9 +427,7 @@ def _create_collection(self, model):
427427 """
428428
429429 db = self .get_database ()
430- if not hasattr (model , "encrypted" ):
431- db .create_collection (model ._meta .db_table )
432- else :
430+ if hasattr (model , "encrypted" ) and model .encrypted :
433431 client = self .connection .connection
434432 ce = get_client_encryption (
435433 client ,
@@ -442,14 +440,19 @@ def _create_collection(self, model):
442440 self ._get_encrypted_fields_map (model ),
443441 settings .KMS_PROVIDER ,
444442 )
443+ else :
444+ db .create_collection (model ._meta .db_table )
445445
446446 def _get_encrypted_fields_map (self , model ):
447447 conn = self .connection
448448 fields = model ._meta .fields
449449 return {
450450 "fields" : [
451451 {
452- "path" : field .db_column ,
452+ # (Pdb) fields[2].db_column
453+ # (Pdb) fields[2].name
454+ # 'ssn'
455+ "path" : field .name ,
453456 "bsonType" : field .db_type (conn ),
454457 # Specify queries in the field definition as a list of query
455458 # types e.g. queries=["equality", "range"]
You can’t perform that action at this time.
0 commit comments