From 6f62327bef71316fa250ae4f9a9d543a5075bc5e Mon Sep 17 00:00:00 2001 From: Sam Dudley Date: Tue, 24 Sep 2024 15:51:58 +0100 Subject: [PATCH] FFT-50 Improve local env test data and DX --- .env.example | 2 +- .github/workflows/ci.yml | 5 +- ...simplehistoryanalysis1_options_and_more.py | 321 ++++++++++++++++++ config/settings/ci.py | 2 + config/settings/local.py | 2 + .../commands/create_stub_forecast_data.py | 1 + .../create_stub_future_forecast_data.py | 1 + ..._alter_historicalgroup_options_and_more.py | 83 +++++ ...toryarchivedcostcentre_options_and_more.py | 111 ++++++ ...plehistoryfiledownload_options_and_more.py | 27 ++ end_of_month/end_of_month_actions.py | 4 + ...istoryendofmonthstatus_options_and_more.py | 55 +++ ...ualuploadmonthlyfigure_options_and_more.py | 153 +++++++++ ...torygiftandhospitality_options_and_more.py | 83 +++++ makefile | 14 +- ...ualuploadmonthlyfigure_options_and_more.py | 72 ++++ pyproject.toml | 6 + pytest.ini | 4 - ...storyhistoricl5account_options_and_more.py | 97 ++++++ ...ivedsubsegment_options_and_more_updated.py | 250 ++++++++++++++ treasurySS/models.py | 4 +- ...implehistoryfileupload_options_and_more.py | 27 ++ ...orypaysplitcoefficient_options_and_more.py | 86 +++++ 23 files changed, 1398 insertions(+), 12 deletions(-) create mode 100644 chartofaccountDIT/migrations/0015_alter_simplehistoryanalysis1_options_and_more.py create mode 100644 core/migrations/0013_alter_historicalgroup_options_and_more.py create mode 100644 costcentre/migrations/0008_alter_simplehistoryarchivedcostcentre_options_and_more.py create mode 100644 download_file/migrations/0003_alter_simplehistoryfiledownload_options_and_more.py create mode 100644 end_of_month/migrations/0014_alter_simplehistoryendofmonthstatus_options_and_more.py create mode 100644 forecast/migrations/0012_alter_simplehistoryactualuploadmonthlyfigure_options_and_more.py create mode 100644 gifthospitality/migrations/0006_alter_simplehistorygiftandhospitality_options_and_more.py create mode 100644 previous_years/migrations/0006_alter_simplehistoryarchivedactualuploadmonthlyfigure_options_and_more.py delete mode 100644 pytest.ini create mode 100644 treasuryCOA/migrations/0004_alter_simplehistoryhistoricl5account_options_and_more.py create mode 100644 treasurySS/migrations/0007_alter_simplehistoryarchivedsubsegment_options_and_more_updated.py create mode 100644 upload_file/migrations/0006_alter_simplehistoryfileupload_options_and_more.py create mode 100644 upload_split_file/migrations/0005_alter_simplehistorypaysplitcoefficient_options_and_more.py diff --git a/.env.example b/.env.example index 93dbba6a2..0d5cf9b18 100644 --- a/.env.example +++ b/.env.example @@ -4,7 +4,7 @@ ALLOWED_HOSTS="*" DEBUG=True DISABLE_COLLECTSTATIC="0" DATABASE_URL=psql://postgres:postgres@db:5432/fido -REDIS_ENDPOINT=redis://redis:6379 +CACHE_ENDPOINT=redis://redis:6379 # Authbroker AUTHBROKER_CLIENT_ID=copy-from-dev-environment diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 029145df1..ddb6af06c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,11 +44,14 @@ jobs: run: make black-check - name: Run tests - run: make pytest + run: make test-ci - name: Bring up chrome run: docker compose up -d chrome + - name: Run makemigrations in check mode + run: make check-migrations + - name: Run BDD tests run: make bdd diff --git a/chartofaccountDIT/migrations/0015_alter_simplehistoryanalysis1_options_and_more.py b/chartofaccountDIT/migrations/0015_alter_simplehistoryanalysis1_options_and_more.py new file mode 100644 index 000000000..70a8a9067 --- /dev/null +++ b/chartofaccountDIT/migrations/0015_alter_simplehistoryanalysis1_options_and_more.py @@ -0,0 +1,321 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("chartofaccountDIT", "0014_alter_archivedanalysis1_financial_year_and_more"), + ] + + operations = [ + migrations.AlterModelOptions( + name="simplehistoryanalysis1", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Contract Reconciliation (Analysis 1)", + "verbose_name_plural": "historical Contract Reconciliations (Analysis 1)", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryanalysis2", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Market (Analysis 2)", + "verbose_name_plural": "historical Markets (Analysis 2)", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivedanalysis1", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived Contract Reconciliation (Analysis 1)", + "verbose_name_plural": "historical Archived Contract Reconciliations (Analysis 1)", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivedanalysis2", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived Market (Analysis 2)", + "verbose_name_plural": "historical Archived Markets (Analysis 2)", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivedcommercialcategory", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived Commercial Category", + "verbose_name_plural": "historical Archived Commercial Categories", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivedexpenditurecategory", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived Budget Category", + "verbose_name_plural": "historical Archived Budget Categories", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivedfcomapping", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived FCO Mapping", + "verbose_name_plural": "historical Archived FCO Mappings", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivedinterentity", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived Inter-Entity", + "verbose_name_plural": "historical Archived Inter-Entities", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivednaturalcode", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived Natural Account Code (NAC)", + "verbose_name_plural": "historical Archived Natural Account Codes (NAC)", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivedprogrammecode", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived Programme Code", + "verbose_name_plural": "historical Archived Programme Codes", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivedprojectcode", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived Project", + "verbose_name_plural": "historical Archived Projects", + }, + ), + migrations.AlterModelOptions( + name="simplehistorybudgettype", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical budget type", + "verbose_name_plural": "historical budget types", + }, + ), + migrations.AlterModelOptions( + name="simplehistorycommercialcategory", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Commercial Category", + "verbose_name_plural": "historical Commercial Categories", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryexpenditurecategory", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Budget Category", + "verbose_name_plural": "historical Budget Categories", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryfcomapping", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical FCO Mapping", + "verbose_name_plural": "historical FCO Mappings", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryinterentity", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Inter-Entity", + "verbose_name_plural": "historical Inter-Entities", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryinterentityl1", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Government Body", + "verbose_name_plural": "historical Government Bodies", + }, + ), + migrations.AlterModelOptions( + name="simplehistorynaccategory", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Budget Grouping", + "verbose_name_plural": "historical Budget Groupings", + }, + ), + migrations.AlterModelOptions( + name="simplehistorynaturalcode", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Natural Account Code (NAC)", + "verbose_name_plural": "historical Natural Account Codes (NAC)", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryoperatingdeliverycategory", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Operating Delivery Plan Category", + "verbose_name_plural": "historical Operating Delivery Plan Categories", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryprogrammecode", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Programme Code", + "verbose_name_plural": "historical Programme Codes", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryprojectcode", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Project", + "verbose_name_plural": "historical Projects", + }, + ), + migrations.AlterField( + model_name="simplehistoryanalysis1", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryanalysis2", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivedanalysis1", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivedanalysis2", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivedcommercialcategory", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivedexpenditurecategory", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivedfcomapping", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivedinterentity", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivednaturalcode", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivedprogrammecode", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivedprojectcode", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorybudgettype", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorycommercialcategory", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryexpenditurecategory", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryfcomapping", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryinterentity", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryinterentityl1", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorynaccategory", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorynaturalcode", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryoperatingdeliverycategory", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryprogrammecode", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryprojectcode", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/config/settings/ci.py b/config/settings/ci.py index 702c7c19d..e928c2b6a 100644 --- a/config/settings/ci.py +++ b/config/settings/ci.py @@ -9,3 +9,5 @@ ] ASYNC_FILE_UPLOAD = False + +AXES_ENABLED = False diff --git a/config/settings/local.py b/config/settings/local.py index 702c7c19d..e928c2b6a 100644 --- a/config/settings/local.py +++ b/config/settings/local.py @@ -9,3 +9,5 @@ ] ASYNC_FILE_UPLOAD = False + +AXES_ENABLED = False diff --git a/core/management/commands/create_stub_forecast_data.py b/core/management/commands/create_stub_forecast_data.py index 0d89a4bb4..9f163bf42 100644 --- a/core/management/commands/create_stub_forecast_data.py +++ b/core/management/commands/create_stub_forecast_data.py @@ -70,6 +70,7 @@ def create_monthly_figures(): ) budget_amount += 1 + # archive the first 2 months (apr, may) for period_id in range(1, 3): end_of_month_archive(period_id) actual = FinancialPeriod.objects.get(financial_period_code=period_id) diff --git a/core/management/commands/create_stub_future_forecast_data.py b/core/management/commands/create_stub_future_forecast_data.py index cf1eba6fe..6b40d1dba 100644 --- a/core/management/commands/create_stub_future_forecast_data.py +++ b/core/management/commands/create_stub_future_forecast_data.py @@ -86,6 +86,7 @@ def handle(self, *args, **options): action = create_future_year_figure msg = "created" + # if 2020 is the current financial year then this will be 2021, 2022, 2023 for interval in range(1, 4): year_obj = get_financial_year_obj(financial_year + interval) diff --git a/core/migrations/0013_alter_historicalgroup_options_and_more.py b/core/migrations/0013_alter_historicalgroup_options_and_more.py new file mode 100644 index 000000000..4bc33ea31 --- /dev/null +++ b/core/migrations/0013_alter_historicalgroup_options_and_more.py @@ -0,0 +1,83 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("core", "0012_auto_20220427_1046"), + ] + + operations = [ + migrations.AlterModelOptions( + name="historicalgroup", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical group", + "verbose_name_plural": "historical groups", + }, + ), + migrations.AlterModelOptions( + name="historicalpermission", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical permission", + "verbose_name_plural": "historical permissions", + }, + ), + migrations.AlterModelOptions( + name="historicaluser", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical user", + "verbose_name_plural": "historical users", + }, + ), + migrations.AlterModelOptions( + name="simplehistorycommandlog", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical command log", + "verbose_name_plural": "historical command logs", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryfinancialyear", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical financial year", + "verbose_name_plural": "historical financial years", + }, + ), + migrations.AlterField( + model_name="historicalgroup", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="historicalpermission", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="historicaluser", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorycommandlog", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryfinancialyear", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/costcentre/migrations/0008_alter_simplehistoryarchivedcostcentre_options_and_more.py b/costcentre/migrations/0008_alter_simplehistoryarchivedcostcentre_options_and_more.py new file mode 100644 index 000000000..ebf0a4eba --- /dev/null +++ b/costcentre/migrations/0008_alter_simplehistoryarchivedcostcentre_options_and_more.py @@ -0,0 +1,111 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("costcentre", "0007_alter_archivedcostcentre_financial_year"), + ] + + operations = [ + migrations.AlterModelOptions( + name="simplehistoryarchivedcostcentre", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived Cost Centre", + "verbose_name_plural": "historical Archived Cost Centres", + }, + ), + migrations.AlterModelOptions( + name="simplehistorybsceemail", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical BSCE Email", + "verbose_name_plural": "historical BSCE Emails", + }, + ), + migrations.AlterModelOptions( + name="simplehistorybusinesspartner", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Business Partner", + "verbose_name_plural": "historical Business Partners", + }, + ), + migrations.AlterModelOptions( + name="simplehistorycostcentre", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Cost Centre", + "verbose_name_plural": "historical Cost Centres", + }, + ), + migrations.AlterModelOptions( + name="simplehistorycostcentreperson", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Hierarchy Responsibility", + "verbose_name_plural": "historical Hierarchy Responsibilities", + }, + ), + migrations.AlterModelOptions( + name="simplehistorydepartmentalgroup", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Departmental Group", + "verbose_name_plural": "historical Departmental Groups", + }, + ), + migrations.AlterModelOptions( + name="simplehistorydirectorate", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Directorate", + "verbose_name_plural": "historical Directorates", + }, + ), + migrations.AlterField( + model_name="simplehistoryarchivedcostcentre", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorybsceemail", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorybusinesspartner", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorycostcentre", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorycostcentreperson", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorydepartmentalgroup", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorydirectorate", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/download_file/migrations/0003_alter_simplehistoryfiledownload_options_and_more.py b/download_file/migrations/0003_alter_simplehistoryfiledownload_options_and_more.py new file mode 100644 index 000000000..05f352849 --- /dev/null +++ b/download_file/migrations/0003_alter_simplehistoryfiledownload_options_and_more.py @@ -0,0 +1,27 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("download_file", "0002_auto_20230428_1106"), + ] + + operations = [ + migrations.AlterModelOptions( + name="simplehistoryfiledownload", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical file download", + "verbose_name_plural": "historical file downloads", + }, + ), + migrations.AlterField( + model_name="simplehistoryfiledownload", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/end_of_month/end_of_month_actions.py b/end_of_month/end_of_month_actions.py index 85957cd2a..6505615a0 100644 --- a/end_of_month/end_of_month_actions.py +++ b/end_of_month/end_of_month_actions.py @@ -91,6 +91,10 @@ def get_end_of_month(period_code): def end_of_month_archive(period_id, used_for_current_month=False): + """Archive a financial period at the end of the month. + + This is a top-level business logic unit and belongs in a service. + """ end_of_month_info = get_end_of_month(period_id) current_year = get_current_financial_year() diff --git a/end_of_month/migrations/0014_alter_simplehistoryendofmonthstatus_options_and_more.py b/end_of_month/migrations/0014_alter_simplehistoryendofmonthstatus_options_and_more.py new file mode 100644 index 000000000..6ebb54bf5 --- /dev/null +++ b/end_of_month/migrations/0014_alter_simplehistoryendofmonthstatus_options_and_more.py @@ -0,0 +1,55 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("end_of_month", "0013_alter_endofmonthstatus_archived_period_and_more"), + ] + + operations = [ + migrations.AlterModelOptions( + name="simplehistoryendofmonthstatus", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical End of Month Archive Status", + "verbose_name_plural": "historical End of Month Archive Statuses", + }, + ), + migrations.AlterModelOptions( + name="simplehistorymonthlyoutturn", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived outturn", + "verbose_name_plural": "historical Archived outturns", + }, + ), + migrations.AlterModelOptions( + name="simplehistorymonthlytotalbudget", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived total budget", + "verbose_name_plural": "historical Archived total budget", + }, + ), + migrations.AlterField( + model_name="simplehistoryendofmonthstatus", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorymonthlyoutturn", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorymonthlytotalbudget", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/forecast/migrations/0012_alter_simplehistoryactualuploadmonthlyfigure_options_and_more.py b/forecast/migrations/0012_alter_simplehistoryactualuploadmonthlyfigure_options_and_more.py new file mode 100644 index 000000000..0c0cd66ab --- /dev/null +++ b/forecast/migrations/0012_alter_simplehistoryactualuploadmonthlyfigure_options_and_more.py @@ -0,0 +1,153 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("forecast", "0011_alter_actualuploadmonthlyfigure_financial_code_and_more"), + ] + + operations = [ + migrations.AlterModelOptions( + name="simplehistoryactualuploadmonthlyfigure", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical actual upload monthly figure", + "verbose_name_plural": "historical actual upload monthly figures", + }, + ), + migrations.AlterModelOptions( + name="simplehistorybudgetmonthlyfigure", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical budget monthly figure", + "verbose_name_plural": "historical budget monthly figures", + }, + ), + migrations.AlterModelOptions( + name="simplehistorybudgetuploadmonthlyfigure", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical budget upload monthly figure", + "verbose_name_plural": "historical budget upload monthly figures", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryfinancialcode", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical financial code", + "verbose_name_plural": "historical financial codes", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryfinancialperiod", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical financial period", + "verbose_name_plural": "historical financial periods", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryforecasteditstate", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical forecast edit state", + "verbose_name_plural": "historical Forecast edit state", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryforecastexpendituretype", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical forecast expenditure type", + "verbose_name_plural": "historical forecast expenditure types", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryforecastmonthlyfigure", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical forecast monthly figure", + "verbose_name_plural": "historical forecast monthly figures", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryfutureforecasteditstate", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical future forecast edit state", + "verbose_name_plural": "historical Future forecast edit state", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryunlockedforecasteditor", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical unlocked forecast editor", + "verbose_name_plural": "historical unlocked forecast editors", + }, + ), + migrations.AlterField( + model_name="simplehistoryactualuploadmonthlyfigure", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorybudgetmonthlyfigure", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorybudgetuploadmonthlyfigure", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryfinancialcode", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryfinancialperiod", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryforecasteditstate", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryforecastexpendituretype", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryforecastmonthlyfigure", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryfutureforecasteditstate", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryunlockedforecasteditor", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/gifthospitality/migrations/0006_alter_simplehistorygiftandhospitality_options_and_more.py b/gifthospitality/migrations/0006_alter_simplehistorygiftandhospitality_options_and_more.py new file mode 100644 index 000000000..57bbe2fcb --- /dev/null +++ b/gifthospitality/migrations/0006_alter_simplehistorygiftandhospitality_options_and_more.py @@ -0,0 +1,83 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("gifthospitality", "0005_auto_20230428_1106"), + ] + + operations = [ + migrations.AlterModelOptions( + name="simplehistorygiftandhospitality", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Gift and Hospitality", + "verbose_name_plural": "historical Gift and Hospitality", + }, + ), + migrations.AlterModelOptions( + name="simplehistorygiftandhospitalitycategory", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Gift and Hospitality Category", + "verbose_name_plural": "historical Gift and Hospitality Categories", + }, + ), + migrations.AlterModelOptions( + name="simplehistorygiftandhospitalityclassification", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Gift and Hospitality Type", + "verbose_name_plural": "historical Gift and Hospitality Types", + }, + ), + migrations.AlterModelOptions( + name="simplehistorygiftandhospitalitycompany", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Gift and Hospitality Company", + "verbose_name_plural": "historical Gift and Hospitality Companies", + }, + ), + migrations.AlterModelOptions( + name="simplehistorygrade", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Grade", + "verbose_name_plural": "historical Grades", + }, + ), + migrations.AlterField( + model_name="simplehistorygiftandhospitality", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorygiftandhospitalitycategory", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorygiftandhospitalityclassification", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorygiftandhospitalitycompany", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorygrade", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/makefile b/makefile index 751c97642..2b5b9c5ce 100644 --- a/makefile +++ b/makefile @@ -34,11 +34,12 @@ manage = python manage.py create-stub-data: # Create stub data for testing make migrate + $(web) $(manage) set_current_year $(web) $(manage) create_stub_data All $(web) $(manage) create_stub_forecast_data $(web) $(manage) create_stub_future_forecast_data $(web) $(manage) create_data_lake_stub_data - $(web) $(manage) create_test_user + $(web) $(manage) create_test_user --password=password setup: # Set up the project from scratch make down @@ -71,10 +72,10 @@ requirements: # Generate requirements.txt poetry export --with prod --without-hashes --output requirements.txt test: # Run tests - $(web) $(manage) test $(test) + $(web) pytest $(test) -pytest: # Run pytest ignoring; node_modules, front_end, features, staticfiles. - $(web) pytest --ignore=node_modules --ignore=front_end --ignore=features --ignore=staticfiles --random-order -n 4 -v +test-ci: # Run tests with settings for CI + $(web) pytest --random-order -n 4 -v superuser: # Create superuser $(web) $(manage) createsuperuser @@ -112,6 +113,9 @@ webpack: # Run webpack migrations: # Create needed migrations $(web) $(manage) makemigrations +check-migrations: # Check if there are needed migrations + $(web) $(manage) makemigrations --check + migrate: # Run migrations against the local db $(web) $(manage) migrate @@ -123,6 +127,8 @@ db-reset: # Reset the database docker compose rm -f db docker compose up -d db +db-init: create-stub-data # Initialise the database + db-shell: # Open the database container postgres shell $(db) psql -U postgres diff --git a/previous_years/migrations/0006_alter_simplehistoryarchivedactualuploadmonthlyfigure_options_and_more.py b/previous_years/migrations/0006_alter_simplehistoryarchivedactualuploadmonthlyfigure_options_and_more.py new file mode 100644 index 000000000..471bda6d7 --- /dev/null +++ b/previous_years/migrations/0006_alter_simplehistoryarchivedactualuploadmonthlyfigure_options_and_more.py @@ -0,0 +1,72 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ( + "previous_years", + "0005_alter_archivedactualuploadmonthlyfigure_financial_code_and_more", + ), + ] + + operations = [ + migrations.AlterModelOptions( + name="simplehistoryarchivedactualuploadmonthlyfigure", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical archived actual upload monthly figure", + "verbose_name_plural": "historical archived actual upload monthly figures", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivedfinancialcode", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical archived financial code", + "verbose_name_plural": "historical archived financial codes", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivedforecastdata", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical archived forecast data", + "verbose_name_plural": "historical archived forecast datas", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryarchivedforecastdataupload", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical archived forecast data upload", + "verbose_name_plural": "historical archived forecast data uploads", + }, + ), + migrations.AlterField( + model_name="simplehistoryarchivedactualuploadmonthlyfigure", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivedfinancialcode", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivedforecastdata", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryarchivedforecastdataupload", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/pyproject.toml b/pyproject.toml index b6f52cc86..d88b5e164 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -120,3 +120,9 @@ extend-exclude = ["config/*", "features/*", "migrations", "manage.py"] select = ["E", "F", "B"] # Never enforce `E501` (line length violations). ignore = ["E501", "B904"] + +[tool.pytest.ini_options] +minversion = "7.0" +addopts = "--ignore=front_end --ignore=features --ignore=staticfiles --ds=config.settings.ci --reuse-db" +python_files = ["test_*.py", "*_test.py", "tests.py"] +filterwarnings = ["ignore::DeprecationWarning"] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 80380416d..000000000 --- a/pytest.ini +++ /dev/null @@ -1,4 +0,0 @@ -[pytest] -DJANGO_SETTINGS_MODULE = config.settings.prod -# -- recommended but optional: -python_files = tests.py test_*.py *_tests.py diff --git a/treasuryCOA/migrations/0004_alter_simplehistoryhistoricl5account_options_and_more.py b/treasuryCOA/migrations/0004_alter_simplehistoryhistoricl5account_options_and_more.py new file mode 100644 index 000000000..cbcfdf683 --- /dev/null +++ b/treasuryCOA/migrations/0004_alter_simplehistoryhistoricl5account_options_and_more.py @@ -0,0 +1,97 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("treasuryCOA", "0003_alter_historicl5account_financial_year"), + ] + + operations = [ + migrations.AlterModelOptions( + name="simplehistoryhistoricl5account", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived Treasury Level 5 COA", + "verbose_name_plural": "historical Archived Treasury Level 5 COAs", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryl1account", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Treasury Level 1 COA", + "verbose_name_plural": "historical Treasury Level 1 COAs", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryl2account", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Treasury Level 2 COA", + "verbose_name_plural": "historical Treasury Level 2 COAs", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryl3account", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Treasury Level 3 COA", + "verbose_name_plural": "historical Treasury Level 3 COAs", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryl4account", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Treasury Level 4 COA", + "verbose_name_plural": "historical Treasury Level 4 COAs", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryl5account", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Treasury Level 5 COA", + "verbose_name_plural": "historical Treasury Level 5 COAs", + }, + ), + migrations.AlterField( + model_name="simplehistoryhistoricl5account", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryl1account", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryl2account", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryl3account", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryl4account", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryl5account", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/treasurySS/migrations/0007_alter_simplehistoryarchivedsubsegment_options_and_more_updated.py b/treasurySS/migrations/0007_alter_simplehistoryarchivedsubsegment_options_and_more_updated.py new file mode 100644 index 000000000..f312c8ed1 --- /dev/null +++ b/treasurySS/migrations/0007_alter_simplehistoryarchivedsubsegment_options_and_more_updated.py @@ -0,0 +1,250 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ( + "treasurySS", + "0006_alter_archivedsubsegment_control_budget_detail_code_and_more", + ), + ] + + operations = [ + migrations.AlterModelOptions( + name="simplehistoryarchivedsubsegment", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Archived Treasury Segment", + "verbose_name_plural": "historical Archived Treasury Segments", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryestimaterow", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical estimate row", + "verbose_name_plural": "historical estimate rows", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryorganizationcode", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical organization code", + "verbose_name_plural": "historical organization codes", + }, + ), + migrations.AlterModelOptions( + name="simplehistorysegment", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical segment", + "verbose_name_plural": "historical segments", + }, + ), + migrations.AlterModelOptions( + name="simplehistorysegmentgrandparent", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical segment grand parent", + "verbose_name_plural": "historical segment grand parents", + }, + ), + migrations.AlterModelOptions( + name="simplehistorysegmentparent", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical segment parent", + "verbose_name_plural": "historical segment parents", + }, + ), + migrations.AlterModelOptions( + name="simplehistorysubsegment", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical Sub Segment", + "verbose_name_plural": "historical Sub Segments", + }, + ), + migrations.AlterField( + model_name="archivedsubsegment", + name="control_budget_detail_code", + field=models.CharField( + choices=[ + ("DEL", (("DEL ADMIN", "DEL ADMIN"), ("DEL PROG", "DEL PROG"))), + ("NON-BUDGET", "NON-BUDGET"), + ( + "AME", + (("DEPT AME", "DEPT AME"), ("NON-DEPT AME", "NON-DEPT AME")), + ), + ], + default="NON-BUDGET", + max_length=50, + verbose_name="control budget detail code", + ), + ), + migrations.AlterField( + model_name="simplehistoryarchivedsubsegment", + name="control_budget_detail_code", + field=models.CharField( + choices=[ + ("DEL", (("DEL ADMIN", "DEL ADMIN"), ("DEL PROG", "DEL PROG"))), + ("NON-BUDGET", "NON-BUDGET"), + ( + "AME", + (("DEPT AME", "DEPT AME"), ("NON-DEPT AME", "NON-DEPT AME")), + ), + ], + default="NON-BUDGET", + max_length=50, + verbose_name="control budget detail code", + ), + ), + migrations.AlterField( + model_name="simplehistoryarchivedsubsegment", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryestimaterow", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryorganizationcode", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorysegment", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorysegmentgrandparent", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorysegmentparent", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorysubsegment", + name="control_budget_detail_code", + field=models.CharField( + choices=[ + ("DEL", (("DEL ADMIN", "DEL ADMIN"), ("DEL PROG", "DEL PROG"))), + ("NON-BUDGET", "NON-BUDGET"), + ( + "AME", + (("DEPT AME", "DEPT AME"), ("NON-DEPT AME", "NON-DEPT AME")), + ), + ], + default="NON-BUDGET", + max_length=50, + verbose_name="control budget detail code", + ), + ), + migrations.AlterField( + model_name="simplehistorysubsegment", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="subsegment", + name="control_budget_detail_code", + field=models.CharField( + choices=[ + ("DEL", (("DEL ADMIN", "DEL ADMIN"), ("DEL PROG", "DEL PROG"))), + ("NON-BUDGET", "NON-BUDGET"), + ( + "AME", + (("DEPT AME", "DEPT AME"), ("NON-DEPT AME", "NON-DEPT AME")), + ), + ], + default="NON-BUDGET", + max_length=50, + verbose_name="control budget detail code", + ), + ), + migrations.AlterField( + model_name="archivedsubsegment", + name="control_budget_detail_code", + field=models.CharField( + choices=[ + ("DEL", (("DEL ADMIN", "DEL ADMIN"), ("DEL PROG", "DEL PROG"))), + ( + "AME", + (("DEPT AME", "DEPT AME"), ("NON-DEPT AME", "NON-DEPT AME")), + ), + ("NON-BUDGET", "NON-BUDGET"), + ], + default="NON-BUDGET", + max_length=50, + verbose_name="control budget detail code", + ), + ), + migrations.AlterField( + model_name="simplehistoryarchivedsubsegment", + name="control_budget_detail_code", + field=models.CharField( + choices=[ + ("DEL", (("DEL ADMIN", "DEL ADMIN"), ("DEL PROG", "DEL PROG"))), + ( + "AME", + (("DEPT AME", "DEPT AME"), ("NON-DEPT AME", "NON-DEPT AME")), + ), + ("NON-BUDGET", "NON-BUDGET"), + ], + default="NON-BUDGET", + max_length=50, + verbose_name="control budget detail code", + ), + ), + migrations.AlterField( + model_name="simplehistorysubsegment", + name="control_budget_detail_code", + field=models.CharField( + choices=[ + ("DEL", (("DEL ADMIN", "DEL ADMIN"), ("DEL PROG", "DEL PROG"))), + ( + "AME", + (("DEPT AME", "DEPT AME"), ("NON-DEPT AME", "NON-DEPT AME")), + ), + ("NON-BUDGET", "NON-BUDGET"), + ], + default="NON-BUDGET", + max_length=50, + verbose_name="control budget detail code", + ), + ), + migrations.AlterField( + model_name="subsegment", + name="control_budget_detail_code", + field=models.CharField( + choices=[ + ("DEL", (("DEL ADMIN", "DEL ADMIN"), ("DEL PROG", "DEL PROG"))), + ( + "AME", + (("DEPT AME", "DEPT AME"), ("NON-DEPT AME", "NON-DEPT AME")), + ), + ("NON-BUDGET", "NON-BUDGET"), + ], + default="NON-BUDGET", + max_length=50, + verbose_name="control budget detail code", + ), + ), + ] diff --git a/treasurySS/models.py b/treasurySS/models.py index 001105cf6..5afe4203e 100644 --- a/treasurySS/models.py +++ b/treasurySS/models.py @@ -116,11 +116,11 @@ class SubSegmentAbstract(models.Model): DELPROG = "DEL PROG" AMEDEPT = "DEPT AME" AMENODEPT = "NON-DEPT AME" - CONTROL_BUDGET_CHOICES = { + CONTROL_BUDGET_CHOICES = ( (DEL, ((DELADM, "DEL ADMIN"), (DELPROG, "DEL PROG"))), (AME, ((AMEDEPT, "DEPT AME"), (AMENODEPT, "NON-DEPT AME"))), (NB, NB), - } + ) sub_segment_code = models.CharField( max_length=8, primary_key=True, verbose_name="sub segment code" ) diff --git a/upload_file/migrations/0006_alter_simplehistoryfileupload_options_and_more.py b/upload_file/migrations/0006_alter_simplehistoryfileupload_options_and_more.py new file mode 100644 index 000000000..58b39bced --- /dev/null +++ b/upload_file/migrations/0006_alter_simplehistoryfileupload_options_and_more.py @@ -0,0 +1,27 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("upload_file", "0005_auto_20230428_1106"), + ] + + operations = [ + migrations.AlterModelOptions( + name="simplehistoryfileupload", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical file upload", + "verbose_name_plural": "historical file uploads", + }, + ), + migrations.AlterField( + model_name="simplehistoryfileupload", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/upload_split_file/migrations/0005_alter_simplehistorypaysplitcoefficient_options_and_more.py b/upload_split_file/migrations/0005_alter_simplehistorypaysplitcoefficient_options_and_more.py new file mode 100644 index 000000000..c9606287f --- /dev/null +++ b/upload_split_file/migrations/0005_alter_simplehistorypaysplitcoefficient_options_and_more.py @@ -0,0 +1,86 @@ +# Generated by Django 4.2.15 on 2024-10-02 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ( + "upload_split_file", + "0004_alter_paysplitcoefficient_financial_code_to_and_more", + ), + ] + + operations = [ + migrations.AlterModelOptions( + name="simplehistorypaysplitcoefficient", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical pay split coefficient", + "verbose_name_plural": "historical pay split coefficients", + }, + ), + migrations.AlterModelOptions( + name="simplehistorypreviousyearpaysplitcoefficient", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical previous year pay split coefficient", + "verbose_name_plural": "historical previous year pay split coefficients", + }, + ), + migrations.AlterModelOptions( + name="simplehistorysplitpayactualfigure", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical split pay actual figure", + "verbose_name_plural": "historical split pay actual figures", + }, + ), + migrations.AlterModelOptions( + name="simplehistorytemporarycalculatedvalues", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical temporary calculated values", + "verbose_name_plural": "historical temporary calculated valuess", + }, + ), + migrations.AlterModelOptions( + name="simplehistoryuploadpaysplitcoefficient", + options={ + "get_latest_by": ("history_date", "history_id"), + "ordering": ("-history_date", "-history_id"), + "verbose_name": "historical upload pay split coefficient", + "verbose_name_plural": "historical upload pay split coefficients", + }, + ), + migrations.AlterField( + model_name="simplehistorypaysplitcoefficient", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorypreviousyearpaysplitcoefficient", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorysplitpayactualfigure", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistorytemporarycalculatedvalues", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + migrations.AlterField( + model_name="simplehistoryuploadpaysplitcoefficient", + name="history_date", + field=models.DateTimeField(db_index=True), + ), + ]