Skip to content

Commit

Permalink
Change path of /details/[id] to /document/[id]
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbarnes committed Oct 15, 2024
1 parent de4f642 commit 11400de
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion orp/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
orp_search_views.download_search_csv,
name="download_csv",
),
path("details/<str:id>", orp_search_views.details, name="details"),
path("document/<str:id>", orp_search_views.document, name="document"),
path("healthcheck/", core_views.health_check, name="healthcheck"),
path(
"accessibility-statement/",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion orp/orp_search/templates/orp.html
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ <h2 class="govuk-fieldset__heading">
<div class="govuk-summary-list__row--no-border">
<span class="govuk-caption-m">{{ result.document_type }}</span>
<h2 class="govuk-heading-m">
<a href="/details/{{ result.id }}" class="govuk-link">
<a href="/document/{{ result.id }}" class="govuk-link">
{{result.title}}
</a>
</h2>
Expand Down
10 changes: 5 additions & 5 deletions orp/orp_search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@


@require_http_methods(["GET"])
def details(request: HttpRequest, id) -> HttpResponse:
"""Details view.
def document(request: HttpRequest, id) -> HttpResponse:
"""Document details view.
Handles the GET request to fetch details based on the provided id.
"""
Expand All @@ -31,7 +31,7 @@ def details(request: HttpRequest, id) -> HttpResponse:
logger.info("document id: %s", document_id)
if not document_id:
context["error"] = "no document id provided"
return render(request, template_name="details.html", context=context)
return render(request, template_name="document.html", context=context)

# Create a SearchDocumentConfig instance and set the id parameter
config = SearchDocumentConfig(search_terms="", dummy=True, id=document_id)
Expand All @@ -53,11 +53,11 @@ def details(request: HttpRequest, id) -> HttpResponse:
].split("\n")

context["result"] = search_result
return render(request, template_name="details.html", context=context)
return render(request, template_name="document.html", context=context)
except Exception as e:
logger.error("error fetching details: %s", e)
context["error"] = f"error fetching details: {e}"
return render(request, template_name="details.html", context=context)
return render(request, template_name="document.html", context=context)


@require_http_methods(["GET"])
Expand Down

0 comments on commit 11400de

Please sign in to comment.