Skip to content

Commit

Permalink
1688: review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandravaphilips committed Jan 30, 2024
1 parent 1ba9db5 commit 2d34baf
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 17 deletions.
24 changes: 15 additions & 9 deletions africanlii/views/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,21 @@ def get_context_data(self, **kwargs):
)

context["recent_articles"] = recent_articles
context["recent_soft_law"] = GenericDocument.objects.exclude(
frbr_uri_doctype="doc"
).order_by("-date")[:5]
context["recent_reports_guides"] = GenericDocument.objects.filter(
frbr_uri_doctype="doc"
).order_by("-date")[:5]
context["recent_legal_instruments"] = CoreDocument.objects.filter(
frbr_uri_doctype="act"
).order_by("-date")[:5]
context["recent_soft_law"] = (
GenericDocument.objects.exclude(published=False)
.exclude(frbr_uri_doctype="doc")
.order_by("-date")[:5]
)
context["recent_reports_guides"] = (
GenericDocument.objects.exclude(published=False)
.filter(frbr_uri_doctype="doc")
.order_by("-date")[:5]
)
context["recent_legal_instruments"] = (
CoreDocument.objects.exclude(published=False)
.filter(frbr_uri_doctype="act")
.order_by("-date")[:5]
)
context["au_organs"] = AfricanUnionOrgan.objects.prefetch_related("author")
context["au_institutions"] = AfricanUnionInstitution.objects.prefetch_related(
"author"
Expand Down
8 changes: 6 additions & 2 deletions liiweb/views/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

context["court_classes"] = CourtClass.objects.prefetch_related("courts")
context["recent_judgments"] = Judgment.objects.order_by("-date")[:5]
context["recent_legislation"] = Legislation.objects.order_by("-date")[:10]
context["recent_judgments"] = Judgment.objects.exclude(
published=False
).order_by("-date")[:5]
context["recent_legislation"] = Legislation.objects.exclude(
published=False
).order_by("-date")[:10]
context["taxonomies"] = Taxonomy.dump_bulk()
context["taxonomy_url"] = "taxonomy_detail"
context["recent_articles"] = (
Expand Down
18 changes: 13 additions & 5 deletions peachjam/views/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@ class HomePageView(TemplateView):

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
recent_judgments = Judgment.objects.order_by("-date")[:5]
recent_documents = GenericDocument.objects.order_by("-date")[:5]
recent_instruments = LegalInstrument.objects.order_by("-date")[:5]
recent_legislation = Legislation.objects.order_by("-date")[:5]
documents_count = CoreDocument.objects.count()
recent_judgments = Judgment.objects.exclude(published=False).order_by("-date")[
:5
]
recent_documents = GenericDocument.objects.exclude(published=False).order_by(
"-date"
)[:5]
recent_instruments = LegalInstrument.objects.exclude(published=False).order_by(
"-date"
)[:5]
recent_legislation = Legislation.objects.exclude(published=False).order_by(
"-date"
)[:5]
documents_count = CoreDocument.objects.exclude(published=False).count()

authors = Author.objects.exclude(
Q(genericdocument__isnull=True),
Expand Down
2 changes: 1 addition & 1 deletion peachjam_search/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class SearchableDocument(Document):
]

def should_index_object(self, obj):
if isinstance(obj, ExternalDocument):
if isinstance(obj, ExternalDocument) or not obj.published:
return False
return True

Expand Down

0 comments on commit 2d34baf

Please sign in to comment.