Skip to content

Commit c2af761

Browse files
committed
feat: rename medical_records.django to medical_records.django_only in project template
Avoids Django grouping the app's management commands under [django] in manage.py help output, which happens because Django uses the last segment of the app module name as the section header.
1 parent f8cbac2 commit c2af761

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/dbx_python_cli/commands/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ def _enable_qe(project_path: Path, project_name: str, wagtail: bool = False) ->
974974
if qe_settings_file.exists():
975975
qe_content = qe_settings_file.read_text()
976976
qe_content = qe_content.replace(
977-
'"medical_records.django"',
977+
'"medical_records.django_only"',
978978
'"medical_records.wagtail"',
979979
)
980980
qe_settings_file.write_text(qe_content)

src/dbx_python_cli/templates/project_template/project_name/settings/qe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pymongo.encryption_options import AutoEncryptionOpts
44

55
QE_INSTALLED_APPS = [
6-
"medical_records.django",
6+
"medical_records.django_only",
77
]
88

99
DATABASES = {

tests/test_project_command.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def test_enable_qe_activates_settings(tmp_path):
503503
"# INSTALLED_APPS += QE_INSTALLED_APPS # noqa: F405\n"
504504
)
505505
(settings_dir / "qe.py").write_text(
506-
'QE_INSTALLED_APPS = ["medical_records.django"]\n'
506+
'QE_INSTALLED_APPS = ["medical_records.django_only"]\n'
507507
)
508508

509509
_enable_qe(tmp_path, "myproject")
@@ -515,7 +515,7 @@ def test_enable_qe_activates_settings(tmp_path):
515515

516516

517517
def test_enable_qe_uses_django_app_by_default(tmp_path):
518-
"""Test that _enable_qe leaves medical_records.django when wagtail=False."""
518+
"""Test that _enable_qe leaves medical_records.django_only when wagtail=False."""
519519
from dbx_python_cli.commands.project import _enable_qe
520520

521521
settings_dir = tmp_path / "myproject" / "settings"
@@ -525,11 +525,11 @@ def test_enable_qe_uses_django_app_by_default(tmp_path):
525525
"# INSTALLED_APPS += QE_INSTALLED_APPS # noqa: F405\n"
526526
)
527527
qe_file = settings_dir / "qe.py"
528-
qe_file.write_text('QE_INSTALLED_APPS = ["medical_records.django"]\n')
528+
qe_file.write_text('QE_INSTALLED_APPS = ["medical_records.django_only"]\n')
529529

530530
_enable_qe(tmp_path, "myproject", wagtail=False)
531531

532-
assert '"medical_records.django"' in qe_file.read_text()
532+
assert '"medical_records.django_only"' in qe_file.read_text()
533533

534534

535535
def test_enable_qe_uses_wagtail_app_when_stacked(tmp_path):
@@ -543,13 +543,13 @@ def test_enable_qe_uses_wagtail_app_when_stacked(tmp_path):
543543
"# INSTALLED_APPS += QE_INSTALLED_APPS # noqa: F405\n"
544544
)
545545
qe_file = settings_dir / "qe.py"
546-
qe_file.write_text('QE_INSTALLED_APPS = ["medical_records.django"]\n')
546+
qe_file.write_text('QE_INSTALLED_APPS = ["medical_records.django_only"]\n')
547547

548548
_enable_qe(tmp_path, "myproject", wagtail=True)
549549

550550
qe_content = qe_file.read_text()
551551
assert '"medical_records.wagtail"' in qe_content
552-
assert '"medical_records.django"' not in qe_content
552+
assert '"medical_records.django_only"' not in qe_content
553553

554554

555555
def test_create_pyproject_toml_includes_pymongocrypt_when_qe(tmp_path):
@@ -579,10 +579,10 @@ def test_create_pyproject_toml_excludes_pymongocrypt_by_default(tmp_path):
579579

580580

581581
def test_qe_with_medical_records_adds_django_app_to_installed_apps(tmp_path):
582-
"""When --qe and --with medical-records are both used, medical_records.django must be in INSTALLED_APPS.
582+
"""When --qe and --with medical-records are both used, medical_records.django_only must be in INSTALLED_APPS.
583583
584584
_enable_qe uncomments the QE import block in the project settings, which adds
585-
QE_INSTALLED_APPS (containing medical_records.django) to INSTALLED_APPS.
585+
QE_INSTALLED_APPS (containing medical_records.django_only) to INSTALLED_APPS.
586586
"""
587587
from dbx_python_cli.commands.project import _enable_qe
588588

@@ -594,11 +594,11 @@ def test_qe_with_medical_records_adds_django_app_to_installed_apps(tmp_path):
594594
"# INSTALLED_APPS += QE_INSTALLED_APPS # noqa: F405\n"
595595
)
596596
qe_file = settings_dir / "qe.py"
597-
qe_file.write_text('QE_INSTALLED_APPS = ["medical_records.django"]\n')
597+
qe_file.write_text('QE_INSTALLED_APPS = ["medical_records.django_only"]\n')
598598

599599
_enable_qe(tmp_path, "myproject")
600600

601601
settings_content = settings_file.read_text()
602602
assert "from .qe import * # noqa" in settings_content
603603
assert "INSTALLED_APPS += QE_INSTALLED_APPS # noqa: F405" in settings_content
604-
assert '"medical_records.django"' in qe_file.read_text()
604+
assert '"medical_records.django_only"' in qe_file.read_text()

0 commit comments

Comments
 (0)