Skip to content

Commit

Permalink
fixed the args name issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hemant10yadav committed Sep 18, 2024
1 parent 568bb8e commit 0cb0721
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions commcare_connect/opportunity/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,20 +357,20 @@ def get_queryset(self):


@org_member_required
def export_user_visits(request, org_slug, opportunity_id):
get_opportunity_or_404(org_slug=request.org.slug, pk=opportunity_id)
def export_user_visits(request, org_slug, pk):
get_opportunity_or_404(org_slug=request.org.slug, pk=pk)
form = VisitExportForm(data=request.POST)
if not form.is_valid():
messages.error(request, form.errors)
return redirect("opportunity:detail", request.org.slug, opportunity_id)
return redirect("opportunity:detail", request.org.slug, pk)

export_format = form.cleaned_data["format"]
date_range = DateRanges(form.cleaned_data["date_range"])
status = form.cleaned_data["status"]
flatten = form.cleaned_data["flatten_form_data"]

result = generate_visit_export.delay(opportunity_id, date_range, status, export_format, flatten)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, opportunity_id))
result = generate_visit_export.delay(pk, date_range, status, export_format, flatten)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, pk))
return redirect(f"{redirect_url}?export_task_id={result.id}")


Expand Down Expand Up @@ -482,16 +482,16 @@ def get_queryset(self):


@org_member_required
def export_users_for_payment(request, org_slug, opportunity_id):
get_opportunity_or_404(org_slug=request.org.slug, pk=opportunity_id)
def export_users_for_payment(request, org_slug, pk):
get_opportunity_or_404(org_slug=request.org.slug, pk=pk)
form = PaymentExportForm(data=request.POST)
if not form.is_valid():
messages.error(request, form.errors)
return redirect("opportunity:detail", request.org.slug, opportunity_id)
return redirect("opportunity:detail", request.org.slug, pk)

export_format = form.cleaned_data["format"]
result = generate_payment_export.delay(opportunity_id, export_format)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, opportunity_id))
result = generate_payment_export.delay(pk, export_format)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, pk))
return redirect(f"{redirect_url}?export_task_id={result.id}")


Expand Down Expand Up @@ -627,16 +627,16 @@ def get_queryset(self):


@org_member_required
def export_user_status(request, org_slug, opportunity_id):
get_opportunity_or_404(org_slug=request.org.slug, pk=opportunity_id)
def export_user_status(request, org_slug, pk):
get_opportunity_or_404(org_slug=request.org.slug, pk=pk)
form = PaymentExportForm(data=request.POST)
if not form.is_valid():
messages.error(request, form.errors)
return redirect("opportunity:detail", request.org.slug, opportunity_id)
return redirect("opportunity:detail", request.org.slug, pk)

export_format = form.cleaned_data["format"]
result = generate_user_status_export.delay(opportunity_id, export_format)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, opportunity_id))
result = generate_user_status_export.delay(pk, export_format)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, pk))
return redirect(f"{redirect_url}?export_task_id={result.id}")


Expand All @@ -655,16 +655,16 @@ def get_queryset(self):


@org_member_required
def export_deliver_status(request, org_slug, opportunity_id):
get_opportunity_or_404(pk=opportunity_id, org_slug=request.org.slug)
def export_deliver_status(request, org_slug, pk):
get_opportunity_or_404(pk=pk, org_slug=request.org.slug)
form = PaymentExportForm(data=request.POST)
if not form.is_valid():
messages.error(request, form.errors)
return redirect("opportunity:detail", request.org.slug, opportunity_id)
return redirect("opportunity:detail", request.org.slug, pk)

export_format = form.cleaned_data["format"]
result = generate_deliver_status_export.delay(opportunity_id, export_format)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, opportunity_id))
result = generate_deliver_status_export.delay(pk, export_format)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, pk))
return redirect(f"{redirect_url}?export_task_id={result.id}")


Expand Down Expand Up @@ -983,16 +983,16 @@ def get_queryset(self):


@org_member_required
def export_completed_work(request, org_slug, opportunity_id):
get_opportunity_or_404(org_slug=request.org.slug, pk=opportunity_id)
def export_completed_work(request, org_slug, pk):
get_opportunity_or_404(org_slug=request.org.slug, pk=pk)
form = PaymentExportForm(data=request.POST)
if not form.is_valid():
messages.error(request, form.errors)
return redirect("opportunity:detail", request.org.slug, opportunity_id)
return redirect("opportunity:detail", request.org.slug, pk)

export_format = form.cleaned_data["format"]
result = generate_work_status_export.delay(opportunity_id, export_format)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, opportunity_id))
result = generate_work_status_export.delay(pk, export_format)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, pk))
return redirect(f"{redirect_url}?export_task_id={result.id}")


Expand Down Expand Up @@ -1047,16 +1047,16 @@ def suspended_users_list(request, org_slug=None, pk=None):


@org_member_required
def export_catchment_area(request, org_slug, opportunity_id):
get_opportunity_or_404(org_slug=request.org.slug, pk=opportunity_id)
def export_catchment_area(request, org_slug, pk):
get_opportunity_or_404(org_slug=request.org.slug, pk=pk)
form = PaymentExportForm(data=request.POST)
if not form.is_valid():
messages.error(request, form.errors)
return redirect("opportunity:detail", request.org.slug, opportunity_id)
return redirect("opportunity:detail", request.org.slug, pk)

export_format = form.cleaned_data["format"]
result = generate_catchment_area_export.delay(opportunity_id, export_format)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, opportunity_id))
result = generate_catchment_area_export.delay(pk, export_format)
redirect_url = reverse("opportunity:detail", args=(request.org.slug, pk))
return redirect(f"{redirect_url}?export_task_id={result.id}")


Expand Down

0 comments on commit 0cb0721

Please sign in to comment.