Skip to content

Commit 96396cb

Browse files
authored
Merge pull request #137 from QuanMPhm/132/dispatch_changerequest_created
Added coldfront patch to signal when allocation change request is created
2 parents 721ec2e + 54ff0fc commit 96396cb

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ RUN pip3 install -r /tmp/requirements.txt
2525
COPY patches/01_add_api_urls.patch /opt/venv/lib/python3.9/site-packages/
2626
COPY patches/02_fix_allocation_denied_revoked_PR596.patch /opt/venv/lib/python3.9/site-packages/
2727
COPY patches/03_add_active_needs_renewal_status.patch /opt/venv/lib/python3.9/site-packages/
28+
COPY patches/04_add_allocation_change_request_created_signal.patch /opt/venv/lib/python3.9/site-packages/
2829

2930
RUN cd /opt/venv/lib/python3.9/site-packages && \
3031
patch -p1 < 01_add_api_urls.patch && \
3132
patch -p1 < 02_fix_allocation_denied_revoked_PR596.patch && \
32-
patch -p1 < 03_add_active_needs_renewal_status.patch
33+
patch -p1 < 03_add_active_needs_renewal_status.patch && \
34+
patch -p1 < 04_add_allocation_change_request_created_signal.patch
3335

3436
# Final Image
3537
FROM python:3.9-slim-bullseye
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff --git a/coldfront/core/allocation/signals.py b/coldfront/core/allocation/signals.py
2+
index 1c078f0..51277b1 100644
3+
--- a/coldfront/core/allocation/signals.py
4+
+++ b/coldfront/core/allocation/signals.py
5+
@@ -14,3 +14,6 @@ allocation_remove_user = django.dispatch.Signal()
6+
7+
allocation_change_approved = django.dispatch.Signal()
8+
#providing_args=["allocation_pk", "allocation_change_pk"]
9+
+
10+
+allocation_change_created = django.dispatch.Signal()
11+
+ #providing_args=["allocation_pk", "allocation_change_pk"]
12+
diff --git a/coldfront/core/allocation/views.py b/coldfront/core/allocation/views.py
13+
index ec129fc..fa9b39c 100644
14+
--- a/coldfront/core/allocation/views.py
15+
+++ b/coldfront/core/allocation/views.py
16+
@@ -53,6 +53,7 @@ from coldfront.core.allocation.signals import (allocation_new,
17+
allocation_activate_user,
18+
allocation_disable,
19+
allocation_remove_user,
20+
+ allocation_change_created,
21+
allocation_change_approved,)
22+
from coldfront.core.allocation.utils import (generate_guauge_data_from_usage,
23+
get_user_resources)
24+
@@ -1811,6 +1812,12 @@ class AllocationChangeView(LoginRequiredMixin, UserPassesTestMixin, FormView):
25+
26+
messages.success(request, 'Allocation change request successfully submitted.')
27+
28+
+ allocation_change_created.send(
29+
+ sender=self.__class__,
30+
+ allocation_pk=allocation_obj.pk,
31+
+ allocation_change_pk=allocation_change_request_obj.pk,)
32+
+
33+
+
34+
send_allocation_admin_email(allocation_obj,
35+
'New Allocation Change Request',
36+
'email/new_allocation_change_request.txt',

0 commit comments

Comments
 (0)