Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dj4.2] [ch32786] update attachments permissions #3692

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
18745bb
add attachments permission to control files access
roman-karpovich Feb 10, 2023
4c83914
add field monitoring attachments logic to check related third party u…
roman-karpovich Feb 10, 2023
5b857a0
Merge branch 'develop' into ch32786-update-attachments-permissions
roman-karpovich Feb 14, 2023
91b12ef
add psea permissions third party users access
roman-karpovich Feb 14, 2023
30bc937
permit generic fm attachments & tpm partner files
roman-karpovich Feb 14, 2023
04a9043
configure attachments permissions for tpm activity
roman-karpovich Feb 21, 2023
5954d4a
Merge branch 'develop' into ch32786-update-attachments-permissions
roman-karpovich Feb 21, 2023
93ba374
allow unlinked attachments in permissions; add tests for attachmentlink
roman-karpovich Feb 22, 2023
f173547
Merge branch 'develop' into ch32786-update-attachments-permissions
roman-karpovich May 23, 2023
a3608ef
sort permissions
roman-karpovich May 23, 2023
9f52e02
Merge branch 'develop' into ch32786-update-attachments-permissions
roman-karpovich May 29, 2023
91aca25
update code to match realms updates
roman-karpovich May 29, 2023
23318ec
Merge branch 'develop' into ch32786-update-attachments-permissions
roman-karpovich Jun 6, 2023
6fcf3a4
update from develop
robertavram Apr 22, 2024
76ccc0d
update attachments permissions: disallow inactive realms
roman-karpovich Apr 24, 2024
ee3bd64
Merge branch 'develop' into ch32786-update-attachments-permissions
roman-karpovich Apr 24, 2024
1399b6c
add testcases
roman-karpovich Apr 26, 2024
85fb286
Merge remote-tracking branch 'origin/ch32786-update-attachments-permi…
roman-karpovich Apr 26, 2024
adc4cde
Merge branch 'develop' into ch32786-update-attachments-permissions
roman-karpovich Apr 26, 2024
6b6201d
added pagination
emaciupe May 28, 2024
dba75f6
PMP: pagination for pd list; ordering for partner and pd lists
emaciupe May 30, 2024
6e5c5e9
Merge branch 'develop' into ch32786-update-attachments-permissions
roman-karpovich Jun 11, 2024
b002d1a
Merge branch 'develop' into 31883-pmp-list-pagination-ordering
danNordlogic Jun 17, 2024
74d9d70
Added 31883-pmp-list-pagination-ordering branch to circleci
danNordlogic Jun 17, 2024
3146044
fix f-string error
roman-karpovich Jun 19, 2024
bc25f8b
Merge remote-tracking branch 'refs/remotes/origin/ch32786-update-atta…
roman-karpovich Jun 19, 2024
503a972
pep8 fix
roman-karpovich Jun 19, 2024
8c10869
update deprecated assertion
roman-karpovich Jun 19, 2024
956e721
switch to git+unicef-attachments 0.14
roman-karpovich Jun 19, 2024
3794615
Merge branch 'refs/heads/robdj4.2' into robdj4.2-ch32786-update-attac…
roman-karpovich Jun 19, 2024
5990c5d
fix tests
roman-karpovich Jun 19, 2024
5b03f80
validate report reviewer is not self and contains necessary groups
roman-karpovich Jun 28, 2024
c6e3bc4
fix imports
roman-karpovich Jun 28, 2024
62263ac
codestyle
roman-karpovich Jun 28, 2024
df64c9c
add action point supporting documents
roman-karpovich Jul 2, 2024
379370a
code cleanup
roman-karpovich Jul 2, 2024
a1057e7
Merge branch 'develop' into ch36044-add-action-point-supporting-document
roman-karpovich Jul 3, 2024
843e020
Merge branch 'develop' into ch37260-validate-report-reviewer
roman-karpovich Jul 3, 2024
a4207ed
Merge pull request #3709 from unicef/staging
robertavram Jul 5, 2024
8fa266c
make supporting document editable through main serializer
roman-karpovich Jul 8, 2024
f71dff6
Merge remote-tracking branch 'origin/ch36044-add-action-point-support…
roman-karpovich Jul 8, 2024
c6d53fa
Merge branch 'develop' into ch36044-add-action-point-supporting-document
roman-karpovich Jul 8, 2024
f3f8ed4
Merge pull request #3713 from unicef/staging
robertavram Jul 8, 2024
7f0d95a
mark supporting document as optional in options
roman-karpovich Jul 9, 2024
3539858
Merge remote-tracking branch 'origin/ch36044-add-action-point-support…
roman-karpovich Jul 9, 2024
4cbc159
New endpoint for ezHACT FR
emaciupe Jul 9, 2024
a86498e
add eToolsEZHactTokenAuth to rest auth classes settings; tests
emaciupe Jul 10, 2024
c4ee03c
Merge pull request #3720 from unicef/staging
robertavram Jul 11, 2024
65b9d17
Merge pull request #3721 from unicef/develop
robertavram Jul 12, 2024
5579c23
monitoring activities csv export
roman-karpovich Jul 15, 2024
1cb8343
update locales
roman-karpovich Jul 16, 2024
c2882cc
remove validation for setting report reviewer as self
roman-karpovich Jul 16, 2024
cfe4ad3
remove unused code
roman-karpovich Jul 16, 2024
fbc3284
Merge branch 'develop' into ch37260-validate-report-reviewer
roman-karpovich Jul 16, 2024
585d553
Merge branch 'develop' into ch36044-add-action-point-supporting-document
robertavram Jul 24, 2024
b61520a
Merge pull request #3726 from unicef/35286-migrations-reset
robertavram Jul 24, 2024
ddce0af
reset migrations
emaciupe Jul 19, 2024
54ab891
Added PRC Secretary to groups fixture
emaciupe Jun 3, 2024
47c9f0c
Merge pull request #3728 from unicef/migrations
robertavram Jul 24, 2024
e0371d4
Merge branch 'master' into staging
robertavram Jul 24, 2024
d52927d
FAM: skip dates validation on documents before SKIP_VALIDATION_BEFORE…
emaciupe Jul 24, 2024
4508fb4
Update __init__.py
robertavram Jul 24, 2024
9055858
Merge pull request #3729 from unicef/hf-fam-validation
robertavram Jul 24, 2024
3209c7c
Merge branch 'master' into staging
robertavram Jul 24, 2024
85bb819
patch tablib.XLSXFormat.dset_sheet to export data with non ascii
emaciupe Jul 25, 2024
85bc0dd
dev merge
robertavram Jul 25, 2024
11d5537
merge
robertavram Jul 25, 2024
da1bfc7
different handling on different exceptions
emaciupe Jul 25, 2024
ef8af9e
Merge pull request #3732 from unicef/rob42-retry
robertavram Jul 25, 2024
52e6027
Merge branch 'develop' of github.com:unicef/etools into 31883-pmp-lis…
emaciupe Jul 26, 2024
00f8b5c
added RssRealmEditAdminMixin
emaciupe Jul 29, 2024
6c8e14b
require prc secretary role to cancel PD
roman-karpovich Jul 30, 2024
fffc696
don't include cancelled PD's into planned visits counter
roman-karpovich Jul 30, 2024
c784127
fix tests
roman-karpovich Jul 30, 2024
f946351
Merge branch 'develop' into ch37411-monitoring-activities-csv-export
roman-karpovich Jul 30, 2024
82dd2af
tenant_name instead of tenant_id
emaciupe Jul 30, 2024
4e200e8
Merge pull request #3736 from unicef/fix-custom-azure-oauth-base-url
robertavram Jul 30, 2024
e850bf0
Merge branch 'develop' into 37278/new-endpoint-for-ezhact-funds
emaciupe Jul 31, 2024
4bca6fc
Merge branch 'develop' into 31883-pmp-list-pagination-ordering
emaciupe Jul 31, 2024
4d631c7
Merge branch 'develop' into 37435/action-point-export-illegal-char
emaciupe Jul 31, 2024
c792145
fix random failing test
emaciupe Jul 31, 2024
772f143
Merge pull request #3703 from unicef/ch37260-validate-report-reviewer
robertavram Jul 31, 2024
796fca2
Merge branch 'develop' into ch36044-add-action-point-supporting-document
robertavram Jul 31, 2024
5d61d10
Merge pull request #3706 from unicef/ch36044-add-action-point-support…
robertavram Jul 31, 2024
6c59c7c
fix action point migration
emaciupe Aug 1, 2024
2babf4e
Merge pull request #3737 from unicef/fix-action-points-migrations
emaciupe Aug 1, 2024
fa6f607
Merge branch 'develop' of github.com:unicef/etools into 31883-pmp-lis…
emaciupe Aug 1, 2024
5300660
PD list: Don't use pagination by default
emaciupe Aug 1, 2024
8f6d3f5
Merge branch '31883-pmp-list-pagination-ordering' of github.com:unice…
emaciupe Aug 1, 2024
b548aa5
Merge branch 'develop' of github.com:unicef/etools into 37653/rss-gro…
emaciupe Aug 1, 2024
6e7df4e
Merge pull request #3678 from unicef/31883-pmp-list-pagination-ordering
robertavram Aug 1, 2024
7ab80c9
Merge pull request #3734 from unicef/ch37638-update-planned-visits-ca…
robertavram Aug 1, 2024
0dbe179
Merge branch 'develop' into 37278/new-endpoint-for-ezhact-funds
robertavram Aug 1, 2024
34d56f2
update intervention cancel permissions: any prc secretary can cancel
roman-karpovich Aug 2, 2024
45dc75e
update custom storage to match azure blob storage v12 changes
roman-karpovich Aug 2, 2024
1a0ab7b
Merge branch 'develop' into ch37643-update-intervention-permissions
roman-karpovich Aug 2, 2024
06e8b01
Merge branch 'refs/heads/develop' into ch37411-monitoring-activities-…
roman-karpovich Aug 2, 2024
9e257bb
update locales
roman-karpovich Aug 2, 2024
51a4600
Merge branch 'develop' of github.com:unicef/etools into 37278/new-end…
emaciupe Aug 6, 2024
83b1e23
added tenant switch "ezhact_external_fr_disabled"
emaciupe Aug 6, 2024
779fa33
Merge branch '37278/new-endpoint-for-ezhact-funds' of github.com:unic…
emaciupe Aug 6, 2024
071db98
Merge pull request #3738 from unicef/ch37680-fix-azure-blob-storage
robertavram Aug 7, 2024
9d62239
fm users api: filter out inactive users
roman-karpovich Aug 8, 2024
2855236
Merge branch 'develop' into ch37411-monitoring-activities-csv-export
roman-karpovich Aug 9, 2024
8150647
Merge branch 'develop' into ch37643-update-intervention-permissions
roman-karpovich Aug 9, 2024
a1b4f91
add remote monitoring switch for activities
roman-karpovich Aug 13, 2024
a903f99
[ch37461] AMP: allow external users to update their job descriptions
emaciupe Aug 19, 2024
30cd7dc
Merge branch 'develop' of github.com:unicef/etools into 37653/rss-gro…
emaciupe Aug 26, 2024
237f7bd
RSS group user enabled certain restricted actions on Realms in admin
emaciupe Aug 5, 2024
c9d85f6
Merge pull request #3742 from unicef/37461/amp-update-job-title
robertavram Aug 27, 2024
02c0ee7
Merge pull request #3739 from unicef/ch37260-fix-report-reviewer-filter
robertavram Aug 27, 2024
a976d02
Merge pull request #3741 from unicef/ch37583-remote-monitoring
robertavram Aug 27, 2024
a79bdd0
Merge pull request #3735 from unicef/ch37643-update-intervention-perm…
robertavram Aug 27, 2024
a7b0afb
Merge branch 'develop' of github.com:unicef/etools into 37435/action-…
emaciupe Aug 28, 2024
f40ddfc
change request: from import
emaciupe Aug 28, 2024
cec64bc
Merge branch '37435/action-point-export-illegal-char' of github.com:u…
emaciupe Aug 28, 2024
c1ec148
Merge branch 'refs/heads/develop' into ch37411-monitoring-activities-…
roman-karpovich Aug 28, 2024
59b8a13
update translations
roman-karpovich Aug 28, 2024
5d24a89
isort
emaciupe Aug 28, 2024
063077a
FM Monitoring activities: selected report reviewer to approve or rej…
emaciupe Aug 30, 2024
c231ca2
Rename General Observations from Overall Finding
emaciupe Aug 30, 2024
b695c05
Merge pull request #3744 from unicef/36920/rename-general-observation…
robertavram Aug 30, 2024
fb489ec
Merge branch 'develop' into ch37411-monitoring-activities-csv-export
robertavram Aug 30, 2024
e17bc22
Merge pull request #3722 from unicef/ch37411-monitoring-activities-cs…
robertavram Aug 30, 2024
a7c48f2
FM ReportReviewer fix
robertavram Aug 30, 2024
af58c7c
Merge branch 'develop' of github.com:unicef/etools into 37949/report_…
emaciupe Aug 30, 2024
5d8ef8a
Merge branch '37949/report_viewer-to-complete-or-reject-activity' of …
emaciupe Aug 30, 2024
7451233
fixed tests
emaciupe Aug 30, 2024
0a3a919
update locales
emaciupe Aug 30, 2024
24f483f
[ch36598] Mandatory questions and fields
emaciupe Sep 2, 2024
feadf28
tests
emaciupe Sep 2, 2024
7d1eb20
Merge branch 'staging' of github.com:unicef/etools into update-develop
emaciupe Sep 3, 2024
9315aeb
Merge pull request #3748 from unicef/update-develop
emaciupe Sep 3, 2024
8436ddd
Merge pull request #3745 from unicef/develop
robertavram Sep 3, 2024
a1ee7ee
Revert "Update develop from staging"
emaciupe Sep 3, 2024
e666c62
[ch37624] Request for Addition of Indicator Status Column in CSV Expo…
emaciupe Sep 3, 2024
259f38d
Merge pull request #3749 from unicef/revert-3748-update-develop
emaciupe Sep 3, 2024
6b10a2c
Merge branch 'develop' into 36598/mandatory-questions-and-fields
danNordlogic Sep 3, 2024
ef5594f
Merge pull request #3746 from unicef/36598/mandatory-questions-and-fi…
robertavram Sep 3, 2024
7136384
Merge branch 'develop' into 37949/report_viewer-to-complete-or-reject…
emaciupe Sep 4, 2024
1eae8b0
Merge pull request #3743 from unicef/37949/report_viewer-to-complete-…
emaciupe Sep 4, 2024
8db336c
added placeholder to blueprint General Observations
emaciupe Sep 4, 2024
91b4784
locale: compilemessages
emaciupe Sep 4, 2024
82b7564
[ch37949] FM Monitoring activities: selected report reviewer to appro…
emaciupe Sep 4, 2024
02534f8
Merge branch '37949/report_viewer-to-complete-or-reject-activity' of …
emaciupe Sep 4, 2024
10c02b6
freeze versions
robertavram Sep 5, 2024
2093a78
Update manage.py
robertavram Sep 5, 2024
e248e73
Merge branch 'develop' of github.com:unicef/etools into general-obser…
emaciupe Sep 5, 2024
974a51f
Merge branch 'develop' of github.com:unicef/etools into 37949/report_…
emaciupe Sep 5, 2024
60ced51
Merge pull request #3751 from unicef/general-observations-placeholder
emaciupe Sep 5, 2024
6e371a4
Merge branch 'develop' into 37949/report_viewer-to-complete-or-reject…
emaciupe Sep 5, 2024
cfac2b7
Merge pull request #3752 from unicef/37949/report_viewer-to-complete-…
emaciupe Sep 5, 2024
992c1fe
Merge branch 'develop' into 37624-indicator-status-in-exports
emaciupe Sep 5, 2024
87d08d1
Merge branch 'develop' into 37435/action-point-export-illegal-char
emaciupe Sep 5, 2024
9f184f7
import setuptools in settings insead of manage.py
emaciupe Sep 5, 2024
793f197
Merge pull request #3753 from unicef/ci-cd-setuptools-issue
emaciupe Sep 5, 2024
93502ea
setuptools to make distutils available for import
robertavram Sep 5, 2024
bcb1ae4
Update __init__.py
robertavram Sep 5, 2024
54b4f48
Merge branch 'develop' into 37624-indicator-status-in-exports
robertavram Sep 5, 2024
e18aabb
Merge pull request #3750 from unicef/37624-indicator-status-in-exports
robertavram Sep 5, 2024
c2b708e
Merge branch 'staging' into develop
robertavram Sep 5, 2024
71bb005
Merge pull request #3731 from unicef/37435/action-point-export-illega…
robertavram Sep 5, 2024
c987fbd
Merge pull request #3733 from unicef/37653/rss-group-update-unicef-re…
robertavram Sep 5, 2024
c5abe6d
Merge branch 'develop' into 37278/new-endpoint-for-ezhact-funds
robertavram Sep 5, 2024
e4c389d
Merge pull request #3715 from unicef/37278/new-endpoint-for-ezhact-funds
robertavram Sep 5, 2024
031d2a6
RSS user can add only unicef users for Unicef org
emaciupe Sep 6, 2024
2505bc1
Merge branch 'develop' of github.com:unicef/etools into 37653/rss-gro…
emaciupe Sep 6, 2024
31cadd5
Merge pull request #3756 from unicef/37653/rss-group-update-unicef-re…
robertavram Sep 6, 2024
4b50abb
[ch36598] Mandatory questions and fields
emaciupe Sep 9, 2024
b65591e
check for == 'true'
emaciupe Sep 9, 2024
33e39bd
translations
emaciupe Sep 9, 2024
ad30b1d
Merge branch 'develop' of github.com:unicef/etools into 36598/mandato…
emaciupe Sep 9, 2024
e5b9347
condition change
emaciupe Sep 10, 2024
588137b
Merge pull request #3757 from unicef/36598/mandatory-questions-and-fi…
emaciupe Sep 10, 2024
c8e7897
FM: Send notification of activity Submit for pmes and report_reviewer…
emaciupe Sep 11, 2024
606a059
Merge branch 'develop' into submit-notice-recipients
emaciupe Sep 11, 2024
f207b90
set instead of list
emaciupe Sep 11, 2024
eb14da9
Merge pull request #3760 from unicef/submit-notice-recipients
robertavram Sep 11, 2024
b046655
update validation to include only active groups
robertavram Sep 13, 2024
7520109
Merge pull request #3762 from unicef/prc-secretaryfix
robertavram Sep 13, 2024
b5e4f7a
Merge branch 'refs/heads/robdj4.2' into robdj4.2-ch32786-update-attac…
roman-karpovich Sep 16, 2024
f41a5ce
use unicef-attachments commit
roman-karpovich Sep 16, 2024
982fad4
Merge branch 'refs/heads/develop' into robdj4.2-ch32786-update-attach…
roman-karpovich Sep 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,194 changes: 677 additions & 517 deletions pdm.lock

Large diffs are not rendered by default.

127 changes: 63 additions & 64 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,72 +9,71 @@ authors = [
]

dependencies = [
"azure-common",
"azure-storage-blob",
"azure-storage-common",
"carto",
"celery",
"cryptography",
"dj-database-url",
"dj-static",
"Django==4.2.3",
"django-admin-extra-urls",
"django-appconf",
"django-celery-beat",
"django-celery-email",
"django-celery-results",
"django-contrib-comments",
"django-cors-headers",
"django-debug-toolbar",
"django-extensions",
"django-easy-pdf3",
"django-filter",
"django-fsm",
"django-import-export",
"django-js-asset",
"django-leaflet",
"django-logentry-admin",
"django-model-utils",
"django-ordered-model",
"django-post-office",
"django-redis-cache",
"django-rest-swagger",
'azure-common==1.1.28',
'azure-storage-blob==12.20.0',
'azure-storage-common==2.1.0',
'carto==1.11.3',
'celery==5.4.0',
'cryptography==42.0.7',
'dj-database-url==2.1.0',
'dj-static==0.0.6',
'Django==4.2.3',
'django-admin-extra-urls==4.1.1',
'django-appconf==1.0.6',
'django-celery-beat==2.6.0',
'django-celery-email==3.0.0',
'django-celery-results==2.5.1',
'django-contrib-comments==2.2.0',
'django-cors-headers==4.3.1',
'django-debug-toolbar==4.3.0',
'django-easy-pdf3==0.1.4',
'django-extensions==3.2.3',
'django-filter==24.2',
'django-fsm==3.0.0',
'django-import-export==4.0.2',
'django-js-asset==2.2.0',
'django-leaflet==0.30.0',
'django-logentry-admin==1.1.0',
'django-model-utils==4.5.1',
'django-ordered-model==3.7.4',
'django-post-office==3.8.0',
'django-redis-cache==3.0.1',
'django-rest-swagger==2.2.0',
"django-storages[azure]==1.13.2",
"django-tenants",
"django-timezone-field",
"django-waffle",
"djangorestframework-csv",
"djangorestframework-gis",
"djangorestframework-simplejwt",
"djangorestframework-recursive",
"djangorestframework-xml",
"djangorestframework",
"drf-nested-routers",
"drf-querystringfilter",
"etools-validator",
"etools-offline",
"flower",
"gunicorn",
"newrelic",
"openpyxl",
"pyyaml",
"Pillow",
"psycopg2-binary",
"reportlab",
"sentry-sdk",
"requests",
"social-auth-app-django",
'django-tenants==3.6.1',
'django-timezone-field==6.1.0',
'django-waffle==4.1.0',
'djangorestframework==3.15.1',
'djangorestframework-csv==3.0.2',
'djangorestframework-gis==1.0',
'djangorestframework-recursive==0.1.2',
'djangorestframework-simplejwt==5.3.1',
'djangorestframework-xml==2.0.0',
'drf-nested-routers==0.94.1',
'drf-querystringfilter==1.0.0',
'etools-offline==0.1.0',
'etools-validator==0.5.1',
'flower==2.0.1',
'gunicorn==22.0.0',
'msal==1.28.0',
'newrelic==9.9.1',
'openpyxl==3.1.2',
'psycopg2-binary==2.9.9',
'pyyaml==6.0.1',
'reportlab==4.0.9',
'requests==2.31.0',
'sentry-sdk==2.1.1',
'social-auth-app-django==5.4.1',
"social-auth-core[azuread]==4.5.4",
"tenant-schemas-celery",
"unicef-attachments",
"unicef-djangolib",
"unicef-locations",
"unicef-notification",
"unicef-restlib",
"unicef-snapshot",
"unicef-rest-export",
"unicef-vision",
"msal",
'tenant-schemas-celery==2.2.0',
'unicef-attachments @ git+https://github.com/unicef/unicef-attachments.git@b720a3ef26e3320a559f72ed1918c798dd2d7b67',
'unicef-djangolib==0.7',
'unicef-locations==4.2',
'unicef-notification==1.4',
'unicef-rest-export==0.6',
'unicef-restlib==0.7',
'unicef-snapshot==1.3',
'unicef-vision==0.6',
"gdal==3.8.5",
"jsonschema>=4.22.0",
"setuptools>=70.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/etools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION = __version__ = '11.5.3'
VERSION = __version__ = '11.7'
NAME = 'eTools'
9 changes: 4 additions & 5 deletions src/etools/applications/action_points/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
from django.contrib.contenttypes.admin import GenericStackedInline
from django.urls import reverse

from django_comments.models import Comment
from unicef_snapshot.admin import ActivityInline, SnapshotModelAdmin

from etools.applications.action_points.models import ActionPoint
from etools.applications.action_points.models import ActionPoint, ActionPointComment


class CommentInline(GenericStackedInline):
model = Comment
model = ActionPointComment
ct_field = "content_type"
ct_fk_field = "object_pk"
fields = ["user", "comment", "submit_date"]
Expand All @@ -20,7 +19,7 @@ class CommentInline(GenericStackedInline):

def view_on_site(self, obj):
return reverse('admin:%s_%s_change' %
(self.opts.app_label, self.opts.model_name),
('django_comments', 'comment'),
args=(obj.pk,),
current_app=self.admin_site.name)

Expand All @@ -36,7 +35,7 @@ class ActionPointAdmin(SnapshotModelAdmin):
inlines = (CommentInline, ActivityInline, )
raw_id_fields = ('section', 'office', 'location', 'cp_output', 'partner', 'intervention', 'tpm_activity',
'psea_assessment', 'travel_activity', 'engagement', 'author', 'assigned_by', 'assigned_to',
'monitoring_activity')
'monitoring_activity', 'verified_by', 'potential_verifier')


admin.site.register(ActionPoint, ActionPointAdmin)
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import types

from openpyxl.styles import Alignment, Font
from openpyxl.utils import get_column_letter
from openpyxl.utils.exceptions import IllegalCharacterError
from tablib.formats._xlsx import XLSXFormat


def dset_sheet(cls, dataset, ws, freeze_panes=True, escape=False):
"""Completes given worksheet from given Dataset."""
_package = dataset._package(dicts=False)

for i, sep in enumerate(dataset._separators):
_offset = i
_package.insert((sep[0] + _offset), (sep[1],))

bold = Font(bold=True)
wrap_text = Alignment(wrap_text=True)

for i, row in enumerate(_package):
row_number = i + 1
for j, col in enumerate(row):
col_idx = get_column_letter(j + 1)
cell = ws[f'{col_idx}{row_number}']

# bold headers
if (row_number == 1) and dataset.headers:
cell.font = bold
if freeze_panes:
# Export Freeze only after first Line
ws.freeze_panes = 'A2'

# bold separators
elif len(row) < dataset.width:
cell.font = bold

# wrap the rest
else:
if '\n' in str(col):
cell.alignment = wrap_text

try:
cell.value = col
except ValueError:
cell.value = str(col)
except IllegalCharacterError:
from openpyxl.cell.cell import ILLEGAL_CHARACTERS_RE
cell.value = ILLEGAL_CHARACTERS_RE.sub(r'', col)

if escape and cell.data_type == 'f' and cell.value.startswith('='):
cell.value = cell.value.replace("=", "")


XLSXFormat.dset_sheet = types.MethodType(dset_sheet, XLSXFormat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.2.3 on 2024-08-01 07:38

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('django_comments', '0004_add_object_pk_is_removed_index'),
('action_points', '0002_initial'),
]

operations = [
migrations.CreateModel(
name='ActionPointComment',
fields=[
],
options={
'verbose_name': 'Action Point Comment',
'verbose_name_plural': 'Action Point Comments',
'proxy': True,
'indexes': [],
'constraints': [],
},
bases=('django_comments.comment',),
),
]
16 changes: 15 additions & 1 deletion src/etools/applications/action_points/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
from django.db import connection, models
from django.utils.translation import gettext_lazy as _

from django_comments.models import Comment
from django_fsm import FSMField, transition
from model_utils import Choices, FieldTracker
from model_utils.fields import MonitorField
from model_utils.models import TimeStampedModel
from unicef_attachments.models import Attachment
from unicef_djangolib.fields import CodedGenericRelation
from unicef_snapshot.models import Activity

from etools.applications.action_points.categories.models import Category
Expand All @@ -20,6 +23,17 @@
from etools.libraries.fsm.views import has_action_permission


class ActionPointComment(Comment):
supporting_document = CodedGenericRelation(
Attachment, verbose_name=_('Related Documents'), code='action_points_supporting_document', blank=True
)

class Meta:
proxy = True
verbose_name = _('Action Point Comment')
verbose_name_plural = _('Action Point Comments')


class ActionPointManager(models.Manager):
def get_queryset(self):
return super().get_queryset().prefetch_related('author',
Expand Down Expand Up @@ -87,7 +101,7 @@ class ActionPoint(TimeStampedModel):
default=None, monitor='status', when=[STATUSES.completed])
date_of_verification = MonitorField(verbose_name=_('Date Action Point Verified'), null=True, blank=True,
default=None, monitor='verified_by')
comments = GenericRelation('django_comments.Comment', object_id_field='object_pk')
comments = GenericRelation(ActionPointComment, object_id_field='object_pk')
history = GenericRelation('unicef_snapshot.Activity', object_id_field='target_object_id',
content_type_field='target_content_type')
reference_number = models.CharField(
Expand Down
Loading