Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweaks #1428

Merged
merged 4 commits into from
Aug 11, 2023
Merged

Tweaks #1428

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions peachjam/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ def _wrapped_view(request, *args, **kwargs):

def get_language(request):
"""Get language from the request object and return its 3-letter language code."""
language = get_language_from_request(request)
return Language.objects.get(iso_639_1__iexact=language).iso_639_3
if not hasattr(request, "language"):
language = get_language_from_request(request)
# store it on the request object because it won't change
request.language = Language.objects.get(iso_639_1__iexact=language).iso_639_3
return request.language


def pdfjs_to_text(fname):
Expand Down
3 changes: 1 addition & 2 deletions peachjam/templates/peachjam/_judgment_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<thead>
<tr>
<th scope="col" style="width: 70%">{% trans 'Title' %}</th>
<th scope="col">{% trans 'Judges' %}</th>
<th scope="col">{% trans 'Date' %}</th>
</tr>
</thead>
Expand All @@ -13,8 +12,8 @@
<tr>
<td>
<a href="{{ document.get_absolute_url }}">{{ document.title }}</a>
{% include 'peachjam/_labels.html' with labels=document.labels.all %}
</td>
<td>{{ document.judges_string }}</td>
<td style="white-space: nowrap;">{{ document.date }}</td>
</tr>
{% endfor %}
Expand Down
11 changes: 7 additions & 4 deletions peachjam/templates/peachjam/layouts/document_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
{% block breadcrumbs %}{% endblock %}
{% block document-title %}
<div class="d-md-flex justify-content-md-between py-4">
<h1>{{ document.title }}</h1>
{% include 'peachjam/_labels.html' %}
<div>
<h1>{{ document.title }}</h1>
{% include 'peachjam/_labels.html' %}
</div>
<div class="d-flex align-items-center">
<a href="https://api.whatsapp.com/send?text={{ request.build_absolute_uri }}"
class="btn btn-link"
Expand Down Expand Up @@ -213,8 +215,9 @@ <h1>{{ document.title }}</h1>
</dt>
<dd class="text-muted">
{% for bench in judges %}
{{ bench.judge.name }}
{% if not forloop.last %},{% endif %}
{# djlint:off #}
{{ bench.judge.name }}{% if not forloop.last %},{% endif %}
{# djlint:on #}
{% endfor %}
</dd>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion peachjam/views/courts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CourtDetailView(FilteredDocumentListView):
model = Judgment
template_name = "peachjam/court_detail.html"
navbar_link = "judgments"
queryset = Judgment.objects.prefetch_related("judges")
queryset = Judgment.objects.prefetch_related("labels")

def get_base_queryset(self):
qs = super().get_base_queryset().filter(court=self.court)
Expand Down
Loading