Skip to content

Commit

Permalink
feat(opinion_page): Tweak views to implement new dataclases
Browse files Browse the repository at this point in the history
  • Loading branch information
ERosendo committed Nov 30, 2023
1 parent c7efdef commit 2836be1
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions cl/opinion_page/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
CourtUploadForm,
DocketEntryFilterForm,
)
from cl.opinion_page.types import AuthoritiesContext, RECAPDocCitationRecord
from cl.opinion_page.types import AuthoritiesContext
from cl.opinion_page.utils import core_docket_data, get_case_title
from cl.people_db.models import AttorneyOrganization, CriminalCount, Role
from cl.recap.constants import COURT_TIMEZONES
Expand Down Expand Up @@ -469,15 +469,12 @@ def view_recap_document(
# Override the og:url if we're serving a request to an OG crawler bot
og_file_path_override = f"/{rd.filepath_local}" if is_og_bot else None

total_citation_count, citation_records = get_recap_citations(
rd.pk, top_k=5
)
authorities_context: AuthoritiesContext = AuthoritiesContext.construct(
citation_record=RECAPDocCitationRecord(
cit_records=citation_records,
total_citation_count=total_citation_count,
),
request_query_string=request.META["QUERY_STRING"],
authorities_context: AuthoritiesContext = AuthoritiesContext(
citation_record=rd,
query_string=request.META["QUERY_STRING"],
total_authorities_count=rd.authority_count,
view_all_url="",
doc_type="document",
)

return TemplateResponse(
Expand Down Expand Up @@ -561,8 +558,15 @@ def view_opinion(request: HttpRequest, pk: int, _: str) -> HttpResponse:
):
sponsored = True

authorities_context: AuthoritiesContext = AuthoritiesContext.construct(
cluster, request.META["QUERY_STRING"]
view_authorities_url = reverse(
"view_authorities", args=[cluster.pk, cluster.slug]
)
authorities_context: AuthoritiesContext = AuthoritiesContext(
citation_record=cluster,
query_string=request.META["QUERY_STRING"],
total_authorities_count=cluster.authority_count,
view_all_url=view_authorities_url,
doc_type="opinion",
)

return TemplateResponse(
Expand Down

0 comments on commit 2836be1

Please sign in to comment.