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):
422
422
# The _id column is automatically unique.
423
423
return db_type and field .unique and field .column != "_id"
424
424
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
-
439
425
def _create_collection (self , model ):
440
426
"""
441
427
Create a collection or, if encryption is supported, create
442
428
an encrypted connection then use it to create an encrypted
443
429
client then use that to create an encrypted collection.
444
430
"""
445
431
446
- if self . _supports_encryption (model ):
432
+ if hasattr (model , "encrypted_fields_map" ):
447
433
auto_encryption_opts = self .connection ._settings_dict .get ("OPTIONS" , {}).get (
448
434
"auto_encryption_opts"
449
435
)
Original file line number Diff line number Diff line change 5
5
6
6
7
7
class Person (EncryptedModel ):
8
- ssn = EncryptedCharField ("ssn" , max_length = 11 )
9
8
name = models .CharField ("name" , max_length = 100 )
9
+ ssn = EncryptedCharField ("ssn" , max_length = 11 )
10
10
11
11
def __str__ (self ):
12
- return self .ssn
12
+ return self .name
You can’t perform that action at this time.
0 commit comments