Skip to content

Commit

Permalink
Merge branch 'develop' into mailjet-changes-send-to-call-recipients
Browse files Browse the repository at this point in the history
  • Loading branch information
pkujawa authored Nov 5, 2024
2 parents 55fbb75 + 1721fbf commit fa67564
Show file tree
Hide file tree
Showing 26 changed files with 43 additions and 100 deletions.
114 changes: 31 additions & 83 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ dependencies = [
"sorl-thumbnail==12.9",
"swapper<2.0.0,>=1.3.0",
"tblib<2.0.0,>=1.7.0",
"unicef-power-query<1.0,>=0.4",
"update<1.0.0,>=0.0.1",
"urllib3<2.0.0,>=1.26.9",
"xlrd<2.0,>=1.2",
Expand Down
7 changes: 4 additions & 3 deletions src/hct_mis_api/apps/steficon/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
from django.forms import HiddenInput, Media, Textarea
from django.utils.translation import gettext_lazy as _

from power_query.widget import PythonFormatterEditor

from hct_mis_api.apps.steficon.config import config
from hct_mis_api.apps.steficon.interpreters import Interpreter, mapping
from hct_mis_api.apps.steficon.models import Rule, RuleCommit
from hct_mis_api.apps.steficon.widget import ContentTypeChoiceField
from hct_mis_api.apps.steficon.widget import (
ContentTypeChoiceField,
PythonFormatterEditor,
)

if TYPE_CHECKING:
from django.db.models.fields import _ChoicesCallable
Expand Down
20 changes: 8 additions & 12 deletions src/hct_mis_api/contrib/aurora/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.contrib import admin, messages
from django.contrib.admin.views.main import ChangeList
from django.core.signing import BadSignature, Signer
from django.db.models import QuerySet
from django.db.models import JSONField, QuerySet
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from django.template.response import TemplateResponse
Expand All @@ -24,6 +24,7 @@
from adminfilters.json import JsonFieldFilter
from adminfilters.numbers import NumberFilter
from adminfilters.querystring import QueryStringFilter
from jsoneditor.forms import JSONEditor
from requests.auth import HTTPBasicAuth
from smart_admin.decorators import smart_register

Expand Down Expand Up @@ -101,6 +102,9 @@ class RegistrationAdmin(ExtraButtonsMixin, admin.ModelAdmin):
readonly_fields = ("name", "project", "slug", "extra", "metadata")
list_filter = ("rdi_policy", "project")
raw_id_fields = ("steficon_rule",)
formfield_overrides = {
JSONField: {"widget": JSONEditor},
}


class BaseRDIForm(forms.Form):
Expand Down Expand Up @@ -168,31 +172,28 @@ class AmendRDIForm(BaseRDIForm):
field_order = ["rdi", "registration", "filters"]


class RecordMixinAdmin(ExtraButtonsMixin, admin.ModelAdmin):
@admin.register(Record)
class RecordDatahubAdmin(HOPEModelAdminBase):
list_display = ("id", "registration", "timestamp", "source_id", "status", "ignored")
readonly_fields = (
"id",
"registration",
"timestamp",
"source_id",
# "registration_data_import",
"status",
"error_message",
)
# list_editable = ("ignored",)
exclude = ("data",)
date_hierarchy = "timestamp"
list_filter = (
DepotManager,
# ("registration_data_import", AutoCompleteFilter),
("status", StatusFilter),
("source_id", NumberFilter),
("id", NumberFilter),
("data", JsonFieldFilter),
QueryStringFilter,
)
change_form_template = "registration_datahub/admin/record/change_form.html"
# change_list_template = "registration_datahub/admin/record/change_list.html"

actions = [mass_update, "extract", "async_extract", "create_rdi", "create_sr_lanka_rdi", "count_queryset"]

Expand Down Expand Up @@ -226,7 +227,7 @@ def fetch_aurora(self, request: HttpRequest) -> HttpResponse:
return render(request, "admin/aurora/record/fetch.html", ctx)

def has_add_permission(self, request: HttpRequest) -> bool:
return False
return is_root(request)

def has_delete_permission(self, request: HttpRequest, obj: Optional[Any] = None) -> bool:
return is_root(request)
Expand Down Expand Up @@ -382,11 +383,6 @@ def fetch(self, request: HttpRequest) -> TemplateResponse:
return response


@admin.register(Record)
class RecordDatahubAdmin(RecordMixinAdmin, HOPEModelAdminBase):
pass


class RemeberDataForm(forms.Form):
SYNC_COOKIE = "fetch"
remember = forms.BooleanField(label="Remember me", required=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ def create_household_for_rdi_household(self, record: Any, registration_data_impo
}

mapping = mergedicts(default_mapping, self.registration.mapping, [])

household = self.create_household_data(record, registration_data_import, mapping)
individuals, head, pr_collector, sec_collector = self.create_individuals(
record,
Expand Down

0 comments on commit fa67564

Please sign in to comment.