Skip to content

Commit b0f79ef

Browse files
committed
Code review fixes
1 parent ad70f59 commit b0f79ef

File tree

4 files changed

+3
-30
lines changed

4 files changed

+3
-30
lines changed

django_mongodb_backend/base.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,6 @@ def cursor(self):
336336

337337
def get_database_version(self):
338338
"""Return a tuple of the database's version."""
339-
# TODO: Remove this workaround and replace with
340-
# `tuple(self.connection.server_info()["versionArray"])` when the minimum
341-
# supported version of pymongocrypt is >= 1.14.2 and PYTHON-5429 is resolved.
342-
# See: https://jira.mongodb.org/browse/PYTHON-5429
343339
return tuple(self.connection.admin.command("buildInfo")["versionArray"])
344340

345341
## Transaction API for django_mongodb_backend.transaction.atomic()

django_mongodb_backend/features.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,6 @@ def mongodb_version(self):
596596
def is_mongodb_6_3(self):
597597
return self.mongodb_version >= (6, 3)
598598

599-
@cached_property
600-
def is_mongodb_7_0(self):
601-
return self.mongodb_version >= (7, 0)
602-
603599
@cached_property
604600
def is_mongodb_8_0(self):
605601
return self.mongodb_version >= (8, 0)

django_mongodb_backend/management/commands/showencryptedfieldsmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ def handle(self, *args, **options):
3232
if model_has_encrypted_fields(model):
3333
fields = editor._get_encrypted_fields(model, create_data_keys=False)
3434
encrypted_fields_map[model._meta.db_table] = fields
35-
self.stdout.write(json_util.dumps(encrypted_fields_map, indent=2))
35+
self.stdout.write(json_util.dumps(encrypted_fields_map, indent=4))

docs/ref/contrib/admin.rst

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,8 @@ that you have :ref:`specified the default pk field
2020
class to ensure that encrypted fields are handled correctly in the admin
2121
interface.
2222

23-
Define a model with encrypted fields:
24-
25-
.. code-block:: python
26-
27-
# myapp/models.py
28-
from django.db import models
29-
from django_mongodb_backend.fields import EmbeddedModelField
30-
31-
32-
class Patient(models.Model):
33-
patient_name = models.CharField(max_length=255)
34-
patient_id = models.BigIntegerField()
35-
patient_record = EmbeddedModelField("PatientRecord")
36-
37-
def __str__(self):
38-
return f"{self.patient_name} ({self.patient_id})"
39-
40-
Register it with the Django admin using the ``EncryptedModelAdmin`` as shown
41-
below:
42-
43-
.. code-block:: python
23+
Register encrypted models with the Django admin using the
24+
``EncryptedModelAdmin`` as shown below::
4425

4526
# myapp/admin.py
4627
from django.contrib import admin

0 commit comments

Comments
 (0)