Skip to content

Commit

Permalink
update libs
Browse files Browse the repository at this point in the history
  • Loading branch information
domdinicola committed Oct 30, 2024
1 parent a08563b commit 30dad25
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/hct_mis_api/apps/household/admin/individual.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@

from hct_mis_api.apps.administration.widgets import JsonWidget
from hct_mis_api.apps.core.models import BusinessArea
from hct_mis_api.apps.household.celery_tasks import (
revalidate_phone_number_task,
update_individuals_iban_from_xlsx_task,
)
from hct_mis_api.apps.household.celery_tasks import revalidate_phone_number_task, update_individuals_iban_from_xlsx_task
from hct_mis_api.apps.household.forms import UpdateIndividualsIBANFromXlsxForm
from hct_mis_api.apps.household.models import (
Household,
Expand All @@ -36,6 +33,7 @@
IndividualRoleInHousehold,
XlsxUpdateFile,
)
from hct_mis_api.apps.payment.models import DeliveryMechanismData
from hct_mis_api.apps.utils.admin import (
BusinessAreaForIndividualCollectionListFilter,
HOPEModelAdminBase,
Expand All @@ -50,6 +48,18 @@
logger = logging.getLogger(__name__)


class IndividualDeliveryMechanismDataInline(admin.TabularInline):
model = DeliveryMechanismData
extra = 0
fields = ("delivery_mechanism_choice", "delivery_mechanism", "data", "is_valid")
readonly_fields = ("delivery_mechanism_choice", "delivery_mechanism", "data", "is_valid")
show_change_link = True
can_delete = False

def has_add_permission(self, request: HttpRequest, obj: Optional[Individual] = None) -> bool:
return False


@admin.register(Individual)
class IndividualAdmin(
SoftDeletableAdminMixin,
Expand Down Expand Up @@ -151,6 +161,7 @@ class IndividualAdmin(
("Others", {"classes": ("collapse",), "fields": ("__others__",)}),
]
actions = ["count_queryset", "revalidate_phone_number_sync", "revalidate_phone_number_async"]
inlines = [IndividualDeliveryMechanismDataInline]

def get_queryset(self, request: HttpRequest) -> QuerySet:
return (
Expand Down

0 comments on commit 30dad25

Please sign in to comment.