From cd56de05f20eb46e8c1926cac40f19bcd7ec4396 Mon Sep 17 00:00:00 2001 From: Domenico DiNicola Date: Tue, 5 Nov 2024 11:50:58 +0100 Subject: [PATCH 1/2] admin tweaks --- pdm.lock | 114 +++++------------- pyproject.toml | 1 - src/hct_mis_api/apps/steficon/forms.py | 7 +- .../admin/{power_query => steficon}/code.css | 0 .../codemirror/abcdef.css | 0 .../codemirror/active-line.js | 0 .../codemirror/codemirror.css | 0 .../codemirror/codemirror.js | 0 .../codemirror/django.js | 0 .../codemirror/foldcode.js | 0 .../codemirror/foldgutter.css | 0 .../codemirror/foldgutter.js | 0 .../codemirror/fullscreen.css | 0 .../codemirror/fullscreen.js | 0 .../codemirror/indent-fold.js | 0 .../codemirror/matchbrackets.js | 0 .../codemirror/midnight.css | 0 .../codemirror/overlay.js | 0 .../codemirror/python.js | 0 .../codemirror/xml.js | 0 .../codemirror/yaml.js | 0 .../{power_query => steficon}/colorful.css | 0 .../admin/{power_query => steficon}/diff.css | 0 .../{power_query => steficon}/editor.png | Bin src/hct_mis_api/contrib/aurora/admin.py | 14 +-- .../services/generic_registration_service.py | 1 - 26 files changed, 38 insertions(+), 99 deletions(-) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/code.css (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/abcdef.css (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/active-line.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/codemirror.css (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/codemirror.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/django.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/foldcode.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/foldgutter.css (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/foldgutter.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/fullscreen.css (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/fullscreen.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/indent-fold.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/matchbrackets.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/midnight.css (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/overlay.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/python.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/xml.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/codemirror/yaml.js (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/colorful.css (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/diff.css (100%) rename src/hct_mis_api/apps/steficon/static/admin/{power_query => steficon}/editor.png (100%) diff --git a/pdm.lock b/pdm.lock index 5e301002bb..fa396f63db 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:f093a6434225351cd3b851fbe94559513d7548aa66fd2db6ea3976673c6e5830" +content_hash = "sha256:dffcc5e57d10348c34bee7b2599f6f069357d6b2f783dbcb9314a82727d5724d" [[metadata.targets]] requires_python = "==3.12.*" @@ -104,7 +104,7 @@ files = [ [[package]] name = "azure-core" -version = "1.31.0" +version = "1.32.0" requires_python = ">=3.8" summary = "Microsoft Azure Core Library for Python" groups = ["default"] @@ -114,8 +114,8 @@ dependencies = [ "typing-extensions>=4.6.0", ] files = [ - {file = "azure_core-1.31.0-py3-none-any.whl", hash = "sha256:22954de3777e0250029360ef31d80448ef1be13b80a459bff80ba7073379e2cd"}, - {file = "azure_core-1.31.0.tar.gz", hash = "sha256:656a0dd61e1869b1506b7c6a3b31d62f15984b1a573d6326f6aa2f3e4123284b"}, + {file = "azure_core-1.32.0-py3-none-any.whl", hash = "sha256:eac191a0efb23bfa83fddf321b27b122b4ec847befa3091fa736a5c32c50d7b4"}, + {file = "azure_core-1.32.0.tar.gz", hash = "sha256:22b3c35d6b2dae14990f6c1be2912bf23ffe50b220e708a28ab1bb92b1c730e5"}, ] [[package]] @@ -1178,7 +1178,7 @@ files = [ [[package]] name = "django-rest-extensions" -version = "0.2.0" +version = "1.0.0" summary = "create normal api for all your models" groups = ["default"] dependencies = [ @@ -1186,8 +1186,8 @@ dependencies = [ "djangorestframework", ] files = [ - {file = "django-rest-extensions-0.2.0.tar.gz", hash = "sha256:184df06f1a09d5ce4689d9bff8ea9b80922b998a8b381549db59731523bd9de1"}, - {file = "django_rest_extensions-0.2.0-py3-none-any.whl", hash = "sha256:56fe9e82c5bc8be71998a7da86610efc786343b7989763a986d93b14c0ace53b"}, + {file = "django_rest_extensions-1.0.0-py3-none-any.whl", hash = "sha256:f46e7102b5969dc1ee12e8be0162c8e807076b678245d98bbeb5fb94e117b1ee"}, + {file = "django_rest_extensions-1.0.0.tar.gz", hash = "sha256:3c0b6b2e2448cdf916ff7581c1fd002a70faf50703be4088c94d502d02b4628f"}, ] [[package]] @@ -1491,7 +1491,7 @@ files = [ [[package]] name = "drf-spectacular-sidecar" -version = "2024.7.1" +version = "2024.11.1" requires_python = ">=3.6" summary = "Serve self-contained distribution builds of Swagger UI and Redoc with Django" groups = ["default"] @@ -1499,8 +1499,8 @@ dependencies = [ "Django>=2.2", ] files = [ - {file = "drf_spectacular_sidecar-2024.7.1-py3-none-any.whl", hash = "sha256:5dc8b38ad153e90b328152674c7959bf114bf86360a617a5a4516e135cb832bc"}, - {file = "drf_spectacular_sidecar-2024.7.1.tar.gz", hash = "sha256:beb992d6ece806a2d422ad626983e2472c0a5550de9647a7ed6764716a5abdfe"}, + {file = "drf_spectacular_sidecar-2024.11.1-py3-none-any.whl", hash = "sha256:e2efd49c5bd1a607fd5d120d9da58d78e587852db8220b8880282a849296ff83"}, + {file = "drf_spectacular_sidecar-2024.11.1.tar.gz", hash = "sha256:fcfccc72cbdbe41e93f8416fa0c712d14126b8d1629e65c09c07c8edea24aad0"}, ] [[package]] @@ -2548,16 +2548,6 @@ files = [ {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, ] -[[package]] -name = "pdfkit" -version = "1.0.0" -summary = "Wkhtmltopdf python wrapper to convert html to pdf using the webkit rendering engine and qt" -groups = ["default"] -files = [ - {file = "pdfkit-1.0.0-py3-none-any.whl", hash = "sha256:a7a4ca0d978e44fa8310c4909f087052430a6e8e0b1dd7ceef657f139789f96f"}, - {file = "pdfkit-1.0.0.tar.gz", hash = "sha256:992f821e1e18fc8a0e701ecae24b51a2d598296a180caee0a24c0af181da02a9"}, -] - [[package]] name = "pexpect" version = "4.9.0" @@ -2574,12 +2564,12 @@ files = [ [[package]] name = "phonenumbers" -version = "8.13.48" +version = "8.13.49" summary = "Python version of Google's common library for parsing, formatting, storing and validating international phone numbers." groups = ["default"] files = [ - {file = "phonenumbers-8.13.48-py2.py3-none-any.whl", hash = "sha256:5c51939acefa390eb74119750afb10a85d3c628dc83fd62c52d6f532fcf5d205"}, - {file = "phonenumbers-8.13.48.tar.gz", hash = "sha256:62d8df9b0f3c3c41571c6b396f044ddd999d61631534001b8be7fdf7ba1b18f3"}, + {file = "phonenumbers-8.13.49-py2.py3-none-any.whl", hash = "sha256:e17140955ab3d8f9580727372ea64c5ada5327932d6021ef6fd203c3db8c8139"}, + {file = "phonenumbers-8.13.49.tar.gz", hash = "sha256:e608ccb61f0bd42e6db1d2c421f7c22186b88f494870bf40aa31d1a2718ab0ae"}, ] [[package]] @@ -2862,21 +2852,6 @@ files = [ {file = "pyjwt-2.9.0.tar.gz", hash = "sha256:7e1e5b56cc735432a7369cbfa0efe50fa113ebecdc04ae6922deba8b84582d0c"}, ] -[[package]] -name = "pypdf2" -version = "3.0.1" -requires_python = ">=3.6" -summary = "A pure-python PDF library capable of splitting, merging, cropping, and transforming PDF files" -groups = ["default"] -dependencies = [ - "dataclasses; python_version < \"3.7\"", - "typing-extensions>=3.10.0.0; python_version < \"3.10\"", -] -files = [ - {file = "PyPDF2-3.0.1.tar.gz", hash = "sha256:a74408f69ba6271f71b9352ef4ed03dc53a31aa404d29b5d31f53bfecfee1440"}, - {file = "pypdf2-3.0.1-py3-none-any.whl", hash = "sha256:d16e4205cfee272fbdc0568b68d82be796540b1537508cef59388f839c191928"}, -] - [[package]] name = "pyphen" version = "0.17.0" @@ -3286,25 +3261,25 @@ files = [ [[package]] name = "rpds-py" -version = "0.20.0" +version = "0.20.1" requires_python = ">=3.8" summary = "Python bindings to Rust's persistent data structures (rpds)" groups = ["default"] files = [ - {file = "rpds_py-0.20.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:a84ab91cbe7aab97f7446652d0ed37d35b68a465aeef8fc41932a9d7eee2c1a6"}, - {file = "rpds_py-0.20.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:56e27147a5a4c2c21633ff8475d185734c0e4befd1c989b5b95a5d0db699b21b"}, - {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2580b0c34583b85efec8c5c5ec9edf2dfe817330cc882ee972ae650e7b5ef739"}, - {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b80d4a7900cf6b66bb9cee5c352b2d708e29e5a37fe9bf784fa97fc11504bf6c"}, - {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:50eccbf054e62a7b2209b28dc7a22d6254860209d6753e6b78cfaeb0075d7bee"}, - {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:49a8063ea4296b3a7e81a5dfb8f7b2d73f0b1c20c2af401fb0cdf22e14711a96"}, - {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ea438162a9fcbee3ecf36c23e6c68237479f89f962f82dae83dc15feeceb37e4"}, - {file = "rpds_py-0.20.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:18d7585c463087bddcfa74c2ba267339f14f2515158ac4db30b1f9cbdb62c8ef"}, - {file = "rpds_py-0.20.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d4c7d1a051eeb39f5c9547e82ea27cbcc28338482242e3e0b7768033cb083821"}, - {file = "rpds_py-0.20.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:e4df1e3b3bec320790f699890d41c59d250f6beda159ea3c44c3f5bac1976940"}, - {file = "rpds_py-0.20.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:2cf126d33a91ee6eedc7f3197b53e87a2acdac63602c0f03a02dd69e4b138174"}, - {file = "rpds_py-0.20.0-cp312-none-win32.whl", hash = "sha256:8bc7690f7caee50b04a79bf017a8d020c1f48c2a1077ffe172abec59870f1139"}, - {file = "rpds_py-0.20.0-cp312-none-win_amd64.whl", hash = "sha256:0e13e6952ef264c40587d510ad676a988df19adea20444c2b295e536457bc585"}, - {file = "rpds_py-0.20.0.tar.gz", hash = "sha256:d72a210824facfdaf8768cf2d7ca25a042c30320b3020de2fa04640920d4e121"}, + {file = "rpds_py-0.20.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:36785be22066966a27348444b40389f8444671630063edfb1a2eb04318721e17"}, + {file = "rpds_py-0.20.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:142c0a5124d9bd0e2976089484af5c74f47bd3298f2ed651ef54ea728d2ea42c"}, + {file = "rpds_py-0.20.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dbddc10776ca7ebf2a299c41a4dde8ea0d8e3547bfd731cb87af2e8f5bf8962d"}, + {file = "rpds_py-0.20.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:15a842bb369e00295392e7ce192de9dcbf136954614124a667f9f9f17d6a216f"}, + {file = "rpds_py-0.20.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:be5ef2f1fc586a7372bfc355986226484e06d1dc4f9402539872c8bb99e34b01"}, + {file = "rpds_py-0.20.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dbcf360c9e3399b056a238523146ea77eeb2a596ce263b8814c900263e46031a"}, + {file = "rpds_py-0.20.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ecd27a66740ffd621d20b9a2f2b5ee4129a56e27bfb9458a3bcc2e45794c96cb"}, + {file = "rpds_py-0.20.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d0b937b2a1988f184a3e9e577adaa8aede21ec0b38320d6009e02bd026db04fa"}, + {file = "rpds_py-0.20.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6889469bfdc1eddf489729b471303739bf04555bb151fe8875931f8564309afc"}, + {file = "rpds_py-0.20.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:19b73643c802f4eaf13d97f7855d0fb527fbc92ab7013c4ad0e13a6ae0ed23bd"}, + {file = "rpds_py-0.20.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3c6afcf2338e7f374e8edc765c79fbcb4061d02b15dd5f8f314a4af2bdc7feb5"}, + {file = "rpds_py-0.20.1-cp312-none-win32.whl", hash = "sha256:dc73505153798c6f74854aba69cc75953888cf9866465196889c7cdd351e720c"}, + {file = "rpds_py-0.20.1-cp312-none-win_amd64.whl", hash = "sha256:8bbe951244a838a51289ee53a6bae3a07f26d4e179b96fc7ddd3301caf0518eb"}, + {file = "rpds_py-0.20.1.tar.gz", hash = "sha256:e1791c4aabd117653530dccd24108fa03cc6baf21f58b950d0a73c3b3b29a350"}, ] [[package]] @@ -3845,13 +3820,13 @@ files = [ [[package]] name = "types-setuptools" -version = "75.2.0.20241025" +version = "75.3.0.20241105" requires_python = ">=3.8" summary = "Typing stubs for setuptools" groups = ["dev"] files = [ - {file = "types-setuptools-75.2.0.20241025.tar.gz", hash = "sha256:2949913a518d5285ce00a3b7d88961c80a6e72ffb8f3da0a3f5650ea533bd45e"}, - {file = "types_setuptools-75.2.0.20241025-py3-none-any.whl", hash = "sha256:6721ac0f1a620321e2ccd87a9a747c4a383dc381f78d894ce37f2455b45fcf1c"}, + {file = "types-setuptools-75.3.0.20241105.tar.gz", hash = "sha256:080883032fb26dfb91c748f69e4efbb202aeeb3f9e95e68bf7352b7ab215069f"}, + {file = "types_setuptools-75.3.0.20241105-py3-none-any.whl", hash = "sha256:c5a98b3308fea29d26228978bd83f6ea262d2fd4d967e34e8e49d04708bb3022"}, ] [[package]] @@ -3886,33 +3861,6 @@ files = [ {file = "tzdata-2024.2.tar.gz", hash = "sha256:7d85cc416e9382e69095b7bdf4afd9e3880418a2413feec7069d533d6b4e31cc"}, ] -[[package]] -name = "unicef-power-query" -version = "0.4" -summary = "Provides Basic UNICEF User model and integration with Azure" -groups = ["default"] -dependencies = [ - "PyPDF2", - "celery", - "django", - "django-admin-extra-buttons", - "django-adminactions", - "django-adminfilters", - "django-concurrency", - "django-import-export", - "django-smart-admin", - "kombu", - "natural-keys", - "pdfkit", - "redis", - "sentry-sdk", - "tablib", -] -files = [ - {file = "unicef-power-query-0.4.tar.gz", hash = "sha256:e844e44460cc457a254299d7cf2da9ddfdfb2db13468e6d5f1893bb5d91637b1"}, - {file = "unicef_power_query-0.4-py2.py3-none-any.whl", hash = "sha256:cef72e0658b434f04821e5b7ad665597a813d05f288e9c8a9791ba475110d037"}, -] - [[package]] name = "unittest-xml-reporting" version = "3.2.0" diff --git a/pyproject.toml b/pyproject.toml index 0b8d329e98..477ef2b60a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/src/hct_mis_api/apps/steficon/forms.py b/src/hct_mis_api/apps/steficon/forms.py index 122b3a3a75..55031aeaf2 100644 --- a/src/hct_mis_api/apps/steficon/forms.py +++ b/src/hct_mis_api/apps/steficon/forms.py @@ -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 diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/code.css b/src/hct_mis_api/apps/steficon/static/admin/steficon/code.css similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/code.css rename to src/hct_mis_api/apps/steficon/static/admin/steficon/code.css diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/abcdef.css b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/abcdef.css similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/abcdef.css rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/abcdef.css diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/active-line.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/active-line.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/active-line.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/active-line.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/codemirror.css b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/codemirror.css similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/codemirror.css rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/codemirror.css diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/codemirror.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/codemirror.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/codemirror.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/codemirror.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/django.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/django.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/django.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/django.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/foldcode.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/foldcode.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/foldcode.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/foldcode.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/foldgutter.css b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/foldgutter.css similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/foldgutter.css rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/foldgutter.css diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/foldgutter.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/foldgutter.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/foldgutter.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/foldgutter.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/fullscreen.css b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/fullscreen.css similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/fullscreen.css rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/fullscreen.css diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/fullscreen.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/fullscreen.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/fullscreen.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/fullscreen.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/indent-fold.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/indent-fold.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/indent-fold.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/indent-fold.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/matchbrackets.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/matchbrackets.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/matchbrackets.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/matchbrackets.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/midnight.css b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/midnight.css similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/midnight.css rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/midnight.css diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/overlay.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/overlay.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/overlay.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/overlay.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/python.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/python.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/python.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/python.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/xml.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/xml.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/xml.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/xml.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/yaml.js b/src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/yaml.js similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/codemirror/yaml.js rename to src/hct_mis_api/apps/steficon/static/admin/steficon/codemirror/yaml.js diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/colorful.css b/src/hct_mis_api/apps/steficon/static/admin/steficon/colorful.css similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/colorful.css rename to src/hct_mis_api/apps/steficon/static/admin/steficon/colorful.css diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/diff.css b/src/hct_mis_api/apps/steficon/static/admin/steficon/diff.css similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/diff.css rename to src/hct_mis_api/apps/steficon/static/admin/steficon/diff.css diff --git a/src/hct_mis_api/apps/steficon/static/admin/power_query/editor.png b/src/hct_mis_api/apps/steficon/static/admin/steficon/editor.png similarity index 100% rename from src/hct_mis_api/apps/steficon/static/admin/power_query/editor.png rename to src/hct_mis_api/apps/steficon/static/admin/steficon/editor.png diff --git a/src/hct_mis_api/contrib/aurora/admin.py b/src/hct_mis_api/contrib/aurora/admin.py index 885ceb3016..119fa714b5 100644 --- a/src/hct_mis_api/contrib/aurora/admin.py +++ b/src/hct_mis_api/contrib/aurora/admin.py @@ -168,23 +168,21 @@ 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), @@ -192,7 +190,6 @@ class RecordMixinAdmin(ExtraButtonsMixin, admin.ModelAdmin): 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"] @@ -226,7 +223,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) @@ -382,11 +379,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) diff --git a/src/hct_mis_api/contrib/aurora/services/generic_registration_service.py b/src/hct_mis_api/contrib/aurora/services/generic_registration_service.py index d414cda68f..ce6953cb2e 100644 --- a/src/hct_mis_api/contrib/aurora/services/generic_registration_service.py +++ b/src/hct_mis_api/contrib/aurora/services/generic_registration_service.py @@ -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, From 210a5d1d666233a1f33964463de4f8462204f72a Mon Sep 17 00:00:00 2001 From: Domenico DiNicola Date: Tue, 5 Nov 2024 13:21:51 +0100 Subject: [PATCH 2/2] tweak --- src/hct_mis_api/contrib/aurora/admin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hct_mis_api/contrib/aurora/admin.py b/src/hct_mis_api/contrib/aurora/admin.py index 119fa714b5..e9c9bfe462 100644 --- a/src/hct_mis_api/contrib/aurora/admin.py +++ b/src/hct_mis_api/contrib/aurora/admin.py @@ -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 @@ -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 @@ -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):