Skip to content

Commit

Permalink
Merge branch 'main' into legislation
Browse files Browse the repository at this point in the history
  • Loading branch information
longhotsummer authored May 24, 2024
2 parents f1909d4 + 7409b7c commit 3b11e24
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
9 changes: 9 additions & 0 deletions liiweb/templates/liiweb/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ <h2 class="mb-4">{% trans 'Recent Legislation' %}</h2>
</div>
<div>
{% block lower-row-content %}
{% if recent_gazettes %}
<section class="pb-3 pt-3">
{% block recent-gazettes-title %}
<h2 class="mb-4">{% trans 'Recent Gazettes' %}</h2>
{% endblock %}
{% trans 'View more gazettes' as text %}
{% include 'peachjam/_recent_document_list.html' with documents=recent_gazettes view_more_text=text view_more_url_name='gazettes' %}
</section>
{% endif %}
<section class="pb-3 pt-3">
<h2 class="mb-4">{% trans 'Courts' %}</h2>
{% include 'peachjam/_court_list.html' %}
Expand Down
12 changes: 11 additions & 1 deletion liiweb/views/general.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
from django.views.generic import TemplateView

from peachjam.models import Article, CourtClass, Judgment, Legislation, Taxonomy
from peachjam.models import (
Article,
CourtClass,
Gazette,
Judgment,
Legislation,
Taxonomy,
)


class HomePageView(TemplateView):
Expand All @@ -16,6 +23,9 @@ def get_context_data(self, **kwargs):
context["recent_legislation"] = Legislation.objects.exclude(
published=False
).order_by("-date")[:10]
context["recent_gazettes"] = Gazette.objects.exclude(published=False).order_by(
"-date"
)[:5]
context["taxonomies"] = Taxonomy.dump_bulk()
context["taxonomy_url"] = "taxonomy_detail"
context["recent_articles"] = (
Expand Down
4 changes: 2 additions & 2 deletions peachjam/helpers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os
import string
import subprocess
import tempfile
from datetime import date, datetime
from functools import wraps

import martor.utils
from django.conf import settings
from django.utils.translation import get_language_from_request
from languages_plus.models import Language

Expand Down Expand Up @@ -46,7 +46,7 @@ def pdfjs_to_text(fname):
"""Extract text from fname using pdfjs-compatible script."""
with tempfile.NamedTemporaryFile(suffix=".txt") as outf:
cmd = [
os.path.join(os.path.dirname(__file__), "..", "bin", "pdfjs-to-text"),
settings.PEACHJAM["PDFJS_TO_TEXT"],
fname,
outf.name,
]
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ dependencies = [
"sentry-sdk>=1.16.0",
"whitenoise>=6.0.0",
]

[tool.setuptools.data-files]
"bin" = ["bin/pdfjs-to-text"]

0 comments on commit 3b11e24

Please sign in to comment.