From c1161e81c593cdcae47c2d054679c43153c82470 Mon Sep 17 00:00:00 2001 From: Pawan Verma Date: Thu, 12 Oct 2023 17:01:08 +0530 Subject: [PATCH] Add payment unit link, update view name --- commcare_connect/opportunity/api/views.py | 3 ++- commcare_connect/opportunity/urls.py | 4 ++-- commcare_connect/opportunity/views.py | 2 +- .../templates/opportunity/opportunity_detail.html | 7 +++++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/commcare_connect/opportunity/api/views.py b/commcare_connect/opportunity/api/views.py index 2edb5ea1..988392a7 100644 --- a/commcare_connect/opportunity/api/views.py +++ b/commcare_connect/opportunity/api/views.py @@ -42,7 +42,8 @@ def get_object(self): ) return dict( completed_modules=CompletedModule.objects.filter( - user=self.request.user, opportunity=opportunity_access.opportunity + user=self.request.user, + opportunity=opportunity_access.opportunity, ), assessments=Assessment.objects.filter(user=self.request.user, opportunity=opportunity_access.opportunity), ) diff --git a/commcare_connect/opportunity/urls.py b/commcare_connect/opportunity/urls.py index 4ece9019..cfa2d95c 100644 --- a/commcare_connect/opportunity/urls.py +++ b/commcare_connect/opportunity/urls.py @@ -12,12 +12,12 @@ OpportunityUserTableView, OpportunityUserVisitTableView, add_budget_existing_users, + add_payment_unit, download_export, export_status, export_user_visits, export_users_for_payment, payment_import, - payment_unit_create, update_visit_status_import, ) @@ -47,6 +47,6 @@ path("/payment_table/", view=OpportunityPaymentTableView.as_view(), name="payment_table"), path("/payment_export/", view=export_users_for_payment, name="payment_export"), path("/payment_import/", view=payment_import, name="payment_import"), - path("/payment_unit_create/", view=payment_unit_create, name="payment_unit_create"), + path("/add_payment_unit/", view=add_payment_unit, name="add_payment_unit"), path("/payment_unit_table/", view=OpportunityPaymentUnitTableView.as_view(), name="payment_unit_table"), ] diff --git a/commcare_connect/opportunity/views.py b/commcare_connect/opportunity/views.py index 84dc92b1..d69b921a 100644 --- a/commcare_connect/opportunity/views.py +++ b/commcare_connect/opportunity/views.py @@ -317,7 +317,7 @@ def payment_import(request, org_slug=None, pk=None): return redirect("opportunity:detail", org_slug, pk) -def payment_unit_create(request, org_slug=None, pk=None): +def add_payment_unit(request, org_slug=None, pk=None): opportunity = get_object_or_404(Opportunity, organization=request.org, id=pk) deliver_units = DeliverUnit.objects.filter(app=opportunity.deliver_app, payment_unit__isnull=True) diff --git a/commcare_connect/templates/opportunity/opportunity_detail.html b/commcare_connect/templates/opportunity/opportunity_detail.html index dcab4b38..2e157c96 100644 --- a/commcare_connect/templates/opportunity/opportunity_detail.html +++ b/commcare_connect/templates/opportunity/opportunity_detail.html @@ -32,6 +32,13 @@

{{ object.name }}

Add Budget +
  • + + + Add Payment Unit + +