Skip to content

Commit

Permalink
Merge pull request #442 from dimagi/hy/fix-404-error-for-PM-org
Browse files Browse the repository at this point in the history
Added the org slug in table
  • Loading branch information
hemant10yadav authored Nov 29, 2024
2 parents bdc1bbf + 8c161e6 commit 4acf63d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions commcare_connect/opportunity/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class Meta:
)


class UserVisitReviewTable(tables.Table):
class UserVisitReviewTable(OrgContextTable):
pk = columns.CheckBoxColumn(
accessor="pk",
verbose_name="",
Expand All @@ -389,12 +389,7 @@ class UserVisitReviewTable(tables.Table):
visit_date = columns.Column()
created_on = columns.Column(accessor="review_created_on", verbose_name="Review Requested On")
review_status = columns.Column(verbose_name="Program Manager Review")
user_visit = columns.LinkColumn(
"opportunity:visit_verification",
verbose_name="User Visit",
text="View",
args=[utils.A("opportunity__organization__slug"), utils.A("pk")],
)
user_visit = columns.Column(verbose_name="User Visit", empty_values=())

class Meta:
model = UserVisit
Expand All @@ -412,6 +407,13 @@ class Meta:
)
empty_text = "No visits submitted for review."

def render_user_visit(self, record):
url = reverse(
"opportunity:visit_verification",
kwargs={"org_slug": self.org_slug, "pk": record.pk},
)
return mark_safe(f'<a href="{url}">View</a>')


class PaymentReportTable(tables.Table):
payment_unit = columns.Column(verbose_name="Payment Unit")
Expand Down
2 changes: 1 addition & 1 deletion commcare_connect/opportunity/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ def user_visit_review(request, org_slug, opp_id):
user_visit_reviews = UserVisit.objects.filter(opportunity=opportunity, review_created_on__isnull=False).order_by(
"visit_date"
)
table = UserVisitReviewTable(user_visit_reviews)
table = UserVisitReviewTable(user_visit_reviews, org_slug=request.org.slug)
if not is_program_manager:
table.exclude = ("pk",)
if request.POST and is_program_manager:
Expand Down

0 comments on commit 4acf63d

Please sign in to comment.