Skip to content

Commit

Permalink
add migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
domdinicola committed Jan 15, 2025
1 parent c53ca83 commit 7f09227
Show file tree
Hide file tree
Showing 18 changed files with 201 additions and 14 deletions.
17 changes: 17 additions & 0 deletions src/hct_mis_api/apps/account/migrations/0003_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.25 on 2025-01-15 14:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('account', '0002_migration'),
]

operations = [
migrations.AlterModelOptions(
name='user',
options={'permissions': (('can_load_from_ad', 'Can load users from ActiveDirectory'), ('can_sync_with_ad', 'Can synchronise user with ActiveDirectory'), ('can_create_kobo_user', 'Can create users in Kobo'), ('can_import_from_kobo', 'Can import and sync users from Kobo'), ('can_upload_to_kobo', 'Can upload CSV file to Kobo'), ('can_debug', 'Can access debug information'), ('can_inspect', 'Can inspect objects'), ('quick_links', 'Can see quick links in admin'), ('restrict_help_desk', 'Limit fields to be editable for help desk'), ('can_reindex_programs', 'Can reindex programs'), ('can_add_business_area_to_partner', 'Can add business area to partner'), ('can_import_fixture', 'Can import fixture'))},
),
]
29 changes: 29 additions & 0 deletions src/hct_mis_api/apps/accountability/migrations/0005_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 3.2.25 on 2025-01-15 14:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('accountability', '0004_migration'),
]

operations = [
migrations.RemoveField(
model_name='feedback',
name='is_migration_handled',
),
migrations.RemoveField(
model_name='feedback',
name='migrated_at',
),
migrations.RemoveField(
model_name='message',
name='is_migration_handled',
),
migrations.RemoveField(
model_name='message',
name='migrated_at',
),
]
3 changes: 2 additions & 1 deletion src/hct_mis_api/apps/activity_log/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Any, Optional

from django.contrib import admin
from django.db.models.query import QuerySet
from django.http import HttpRequest

from adminfilters.autocomplete import AutoCompleteFilter
Expand Down Expand Up @@ -41,5 +42,5 @@ def has_add_permission(self, request: HttpRequest) -> bool:
def has_delete_permission(self, request: HttpRequest, obj: Optional[Any] = None) -> bool:
return False

def get_queryset(self, request: HttpRequest) -> "QuerySet":
def get_queryset(self, request: HttpRequest) -> QuerySet:
return super().get_queryset(request).select_related("content_type", "user", "business_area")
21 changes: 21 additions & 0 deletions src/hct_mis_api/apps/core/migrations/0004_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.25 on 2025-01-15 14:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('core', '0003_migration'),
]

operations = [
migrations.AlterModelOptions(
name='businessarea',
options={'ordering': ['name'], 'permissions': (('can_split', 'Can split BusinessArea'), ('can_send_doap', 'Can send DOAP matrix'), ('can_reset_doap', 'Can force sync DOAP matrix'), ('can_export_doap', 'Can export DOAP matrix'), ('ping_rapidpro', 'Can test RapidPRO connection'))},
),
migrations.AlterModelOptions(
name='xlsxkobotemplate',
options={'ordering': ('-created_at',), 'permissions': (('download_last_valid_file', 'Can download the last valid KOBO template'), ('rerun_kobo_import', 'Can rerun a KOBO import'))},
),
]
17 changes: 17 additions & 0 deletions src/hct_mis_api/apps/geo/migrations/0002_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.25 on 2025-01-15 14:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('geo', '0001_migration'),
]

operations = [
migrations.AlterModelOptions(
name='area',
options={'ordering': ('name',), 'permissions': (('import_areas', 'Can import areas'),), 'verbose_name_plural': 'Areas'},
),
]
3 changes: 2 additions & 1 deletion src/hct_mis_api/apps/household/admin/xlsupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django import forms
from django.contrib import admin, messages
from django.db import transaction
from django.db.models.query import QuerySet
from django.forms import Form
from django.http import HttpRequest, HttpResponseRedirect
from django.template.response import TemplateResponse
Expand Down Expand Up @@ -41,7 +42,7 @@ class XlsxUpdateFileAdmin(HOPEModelAdminBase):
)
search_fields = ("file",)

def get_queryset(self, request):
def get_queryset(self, request: HttpRequest) -> QuerySet:
return super().get_queryset(request).select_related("business_area", "rdi", "program", "uploaded_by")

def xlsx_update_stage2(self, request: HttpRequest, old_form: Form) -> TemplateResponse:
Expand Down
6 changes: 3 additions & 3 deletions src/hct_mis_api/apps/household/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ class UpdateByXlsxStage1Form(forms.Form):
business_area = forms.ModelChoiceField(
queryset=BusinessArea.objects.all().order_by("name"),
required=True,
widget=AutocompleteWidget(BusinessArea, None),
widget=AutocompleteWidget(BusinessArea, ""),
)
program = forms.ModelChoiceField(
queryset=Program.objects.filter(status=Program.ACTIVE).order_by("name"),
required=True,
widget=AutocompleteWidget(Program, None),
widget=AutocompleteWidget(Program, ""),
)
registration_data_import = forms.ModelChoiceField(
queryset=RegistrationDataImport.objects.all().order_by("name"),
required=True,
widget=AutocompleteWidget(RegistrationDataImport, None),
widget=AutocompleteWidget(RegistrationDataImport, ""),
)
file = forms.FileField(required=True, help_text="Select XLSX file")

Expand Down
17 changes: 17 additions & 0 deletions src/hct_mis_api/apps/household/migrations/0008_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.25 on 2025-01-15 14:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('household', '0007_migration'),
]

operations = [
migrations.AlterModelOptions(
name='individual',
options={'permissions': (('update_individual_iban', 'Can update individual IBAN'),), 'verbose_name': 'Individual'},
),
]
2 changes: 1 addition & 1 deletion src/hct_mis_api/apps/payment/models/verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class PaymentVerificationPlan(TimeStampedUUIDModel, ConcurrencyModel, UnicefIden
status = models.CharField(max_length=50, choices=STATUS_CHOICES, default=STATUS_PENDING, db_index=True)

payment_plan = models.ForeignKey(
"payment.PaymentPlan", on_delete=models.CASCADE, related_name="payment_verification_plans"
"payment.PaymentPlan", on_delete=models.CASCADE, related_name="payment_verification_plans", null=True
)

sampling = models.CharField(max_length=50, choices=SAMPLING_CHOICES)
Expand Down
5 changes: 3 additions & 2 deletions src/hct_mis_api/apps/periodic_data_update/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Optional

from django.contrib import admin
from django.db.models.query import QuerySet
from django.http import HttpRequest

from adminfilters.autocomplete import AutoCompleteFilter, LinkedAutoCompleteFilter
Expand Down Expand Up @@ -37,7 +38,7 @@ class PeriodicDataUpdateTemplateAdmin(HOPEModelAdminBase):
raw_id_fields = ("file", "program", "business_area", "created_by")
inlines = [PeriodicDataUpdateUploadInline]

def get_queryset(self, request: HttpRequest) -> "QuerySet":
def get_queryset(self, request: HttpRequest) -> QuerySet:
return super().get_queryset(request).select_related("created_by", "program", "business_area")


Expand All @@ -49,7 +50,7 @@ class PeriodicDataUpdateUploadAdmin(HOPEModelAdminBase):
("created_by", AutoCompleteFilter),
)

def get_queryset(self, request: HttpRequest) -> "QuerySet":
def get_queryset(self, request: HttpRequest) -> QuerySet:
return (
super()
.get_queryset(request)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.25 on 2025-01-15 14:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('registration_data', '0001_migration'),
]

operations = [
migrations.AlterModelOptions(
name='registrationdataimport',
options={'permissions': (('rerun_rdi', 'Can Rerun RDI'),), 'verbose_name': 'Registration data import'},
),
]
18 changes: 18 additions & 0 deletions src/hct_mis_api/apps/reporting/migrations/0002_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.25 on 2025-01-15 14:51

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('reporting', '0001_migration'),
]

operations = [
migrations.AlterField(
model_name='dashboardreport',
name='year',
field=models.PositiveSmallIntegerField(default=2025),
),
]
3 changes: 2 additions & 1 deletion src/hct_mis_api/apps/sanction_list/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin
from django.db.models.query import QuerySet
from django.http.request import HttpRequest

from adminfilters.autocomplete import AutoCompleteFilter
Expand Down Expand Up @@ -40,5 +41,5 @@ class SanctionListIndividualDocumentAdmin(HOPEModelAdminBase):
list_filter = (("issuing_country", AutoCompleteFilter), "type_of_document")
search_fields = ("document_number",)

def get_queryset(self, request: HttpRequest) -> "QuerySet":
def get_queryset(self, request: HttpRequest) -> QuerySet:
return super().get_queryset(request).select_related("individual", "issuing_country")
17 changes: 17 additions & 0 deletions src/hct_mis_api/apps/sanction_list/migrations/0002_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.25 on 2025-01-15 14:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('sanction_list', '0001_migration'),
]

operations = [
migrations.AlterModelOptions(
name='sanctionlistindividual',
options={'ordering': ['-listed_on']},
),
]
17 changes: 17 additions & 0 deletions src/hct_mis_api/apps/steficon/migrations/0002_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.25 on 2025-01-15 14:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('steficon', '0001_migration'),
]

operations = [
migrations.AlterModelOptions(
name='rule',
options={'permissions': (('process_file', 'Can Process File'), ('check_diff', 'Can Check Diff'), ('changelog', 'Can Check Changelog'), ('rerun_rule', 'Can Rerun Rule'))},
),
]
4 changes: 0 additions & 4 deletions src/hct_mis_api/apps/utils/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ def restart_preparing_payment_plan(self, request: HttpRequest, pk: str) -> Optio
@button(
visible=lambda btn: is_exporting_xlsx_file(btn) and is_locked_payment_plan(btn),
enabled=lambda btn: is_enabled(btn),
permission=is_root,
)
def restart_exporting_template_for_entitlement(self, request: HttpRequest, pk: str) -> Optional[HttpResponse]:
"""Exporting template for entitlement"""
Expand Down Expand Up @@ -288,7 +287,6 @@ def restart_exporting_template_for_entitlement(self, request: HttpRequest, pk: s
@button(
visible=lambda btn: is_importing_entitlements_xlsx_file(btn) and is_locked_payment_plan(btn),
enabled=lambda btn: is_enabled(btn),
permission=is_root,
)
def restart_importing_entitlements_xlsx_file(self, request: HttpRequest, pk: str) -> Optional[HttpResponse]:
"""Importing entitlement file"""
Expand Down Expand Up @@ -322,7 +320,6 @@ def restart_importing_entitlements_xlsx_file(self, request: HttpRequest, pk: str
@button(
visible=lambda btn: is_exporting_xlsx_file(btn) and is_accepted_payment_plan(btn),
enabled=lambda btn: is_enabled(btn),
permission=is_root,
)
def restart_exporting_payment_plan_list(self, request: HttpRequest, pk: str) -> Optional[HttpResponse]:
"""Exporting payment plan list"""
Expand Down Expand Up @@ -356,7 +353,6 @@ def restart_exporting_payment_plan_list(self, request: HttpRequest, pk: str) ->
@button(
visible=lambda btn: is_importing_reconciliation_xlsx_file(btn) and is_accepted_payment_plan(btn),
enabled=lambda btn: is_enabled(btn),
permission=is_root,
)
def restart_importing_reconciliation_xlsx_file(self, request: HttpRequest, pk: str) -> Optional[HttpResponse]:
"""Importing payment plan list (from xlsx)"""
Expand Down
17 changes: 17 additions & 0 deletions src/hct_mis_api/contrib/aurora/migrations/0004_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.25 on 2025-01-15 14:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('aurora', '0003_migration'),
]

operations = [
migrations.AlterModelOptions(
name='record',
options={'permissions': (('can_fetch_data', 'Can fetch data from aurora'), ('can_add_records', 'Can add records'))},
),
]
2 changes: 1 addition & 1 deletion tests/selenium/targeting/test_targeting.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ def test_create_targeting_with_pdu_decimal_criteria(
pageTargetingDetails.getButtonIconEdit().click()
pageTargetingCreate.getInputIndividualsFiltersBlocksValueTo().send_keys(Keys.BACKSPACE)
pageTargetingCreate.getInputIndividualsFiltersBlocksValueTo().send_keys("5")
bool_no_expected_criteria_text = "Test Decimal Attribute: 2 - 5\nRound 1 (Test Round Decimal 1)"
bool_no_expected_criteria_text = "Test Decimal Attribute: 2 - 4\nRound 1 (Test Round Decimal 1)"

pageTargetingCreate.get_elements(pageTargetingCreate.targetingCriteriaAddDialogSaveButton)[1].click()

Expand Down

0 comments on commit 7f09227

Please sign in to comment.