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

Added coldfront patch to signal when allocation change request is created #137

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ RUN pip3 install -r /tmp/requirements.txt
COPY patches/01_add_api_urls.patch /opt/venv/lib/python3.9/site-packages/
COPY patches/02_fix_allocation_denied_revoked_PR596.patch /opt/venv/lib/python3.9/site-packages/
COPY patches/03_add_active_needs_renewal_status.patch /opt/venv/lib/python3.9/site-packages/
COPY patches/04_add_allocation_change_request_created_signal.patch /opt/venv/lib/python3.9/site-packages/

RUN cd /opt/venv/lib/python3.9/site-packages && \
patch -p1 < 01_add_api_urls.patch && \
patch -p1 < 02_fix_allocation_denied_revoked_PR596.patch && \
patch -p1 < 03_add_active_needs_renewal_status.patch
patch -p1 < 03_add_active_needs_renewal_status.patch && \
patch -p1 < 04_add_allocation_change_request_created_signal.patch

# Final Image
FROM python:3.9-slim-bullseye
Expand Down
36 changes: 36 additions & 0 deletions patches/04_add_allocation_change_request_created_signal.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/coldfront/core/allocation/signals.py b/coldfront/core/allocation/signals.py
index 1c078f0..51277b1 100644
--- a/coldfront/core/allocation/signals.py
+++ b/coldfront/core/allocation/signals.py
@@ -14,3 +14,6 @@ allocation_remove_user = django.dispatch.Signal()

allocation_change_approved = django.dispatch.Signal()
#providing_args=["allocation_pk", "allocation_change_pk"]
+
+allocation_change_created = django.dispatch.Signal()
+ #providing_args=["allocation_pk", "allocation_change_pk"]
diff --git a/coldfront/core/allocation/views.py b/coldfront/core/allocation/views.py
index ec129fc..fa9b39c 100644
--- a/coldfront/core/allocation/views.py
+++ b/coldfront/core/allocation/views.py
@@ -53,6 +53,7 @@ from coldfront.core.allocation.signals import (allocation_new,
allocation_activate_user,
allocation_disable,
allocation_remove_user,
+ allocation_change_created,
allocation_change_approved,)
from coldfront.core.allocation.utils import (generate_guauge_data_from_usage,
get_user_resources)
@@ -1811,6 +1812,12 @@ class AllocationChangeView(LoginRequiredMixin, UserPassesTestMixin, FormView):

messages.success(request, 'Allocation change request successfully submitted.')

+ allocation_change_created.send(
+ sender=self.__class__,
+ allocation_pk=allocation_obj.pk,
+ allocation_change_pk=allocation_change_request_obj.pk,)
+
+
send_allocation_admin_email(allocation_obj,
'New Allocation Change Request',
'email/new_allocation_change_request.txt',
Loading