File tree Expand file tree Collapse file tree 2 files changed +3
-17
lines changed Expand file tree Collapse file tree 2 files changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -422,28 +422,14 @@ def _field_should_have_unique(self, field):
422422 # The _id column is automatically unique.
423423 return db_type and field .unique and field .column != "_id"
424424
425- def _supports_encryption (self , model ):
426- """
427- Check for `supports_encryption` feature and `auto_encryption_opts`
428- and `embedded_fields_map`. If `supports_encryption` is True and
429- `auto_encryption_opts` is in the cached connection settings and
430- the model has an embedded_fields_map property, then encryption
431- is supported.
432- """
433- return (
434- self .connection .features .supports_encryption
435- and self .connection ._settings_dict .get ("OPTIONS" , {}).get ("auto_encryption_opts" )
436- and hasattr (model , "encrypted_fields_map" )
437- )
438-
439425 def _create_collection (self , model ):
440426 """
441427 Create a collection or, if encryption is supported, create
442428 an encrypted connection then use it to create an encrypted
443429 client then use that to create an encrypted collection.
444430 """
445431
446- if self . _supports_encryption (model ):
432+ if hasattr (model , "encrypted_fields_map" ):
447433 auto_encryption_opts = self .connection ._settings_dict .get ("OPTIONS" , {}).get (
448434 "auto_encryption_opts"
449435 )
Original file line number Diff line number Diff line change 55
66
77class Person (EncryptedModel ):
8- ssn = EncryptedCharField ("ssn" , max_length = 11 )
98 name = models .CharField ("name" , max_length = 100 )
9+ ssn = EncryptedCharField ("ssn" , max_length = 11 )
1010
1111 def __str__ (self ):
12- return self .ssn
12+ return self .name
You can’t perform that action at this time.
0 commit comments