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

Restore listing #1916

Merged
merged 7 commits into from
Jul 19, 2024
Merged
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
18 changes: 15 additions & 3 deletions africanlii/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
class ESDocumentFilterForm(BaseDocumentFilterForm):
"""Form for filtering documents in Elasticsearch. Only applies a subset of filters."""

def filter_queryset(self, search, exclude=None):
def filter_queryset(self, search, exclude=None, filter_q=False):
alphabet = self.cleaned_data.get("alphabet")
jurisdictions = self.params.getlist("jurisdictions")
years = self.params.getlist("years")
q = self.params.get("q")
if not isinstance(exclude, list):
exclude = [exclude]

# Order by title then date descending
search = search.sort("title_keyword", "-date")
search = self.order_queryset(search, exclude)

if alphabet and "alphabet" not in exclude:
search = search.filter(
Expand All @@ -25,8 +25,20 @@ def filter_queryset(self, search, exclude=None):
if years and "years" not in exclude:
search = search.filter("terms", year=years)

if filter_q and q and "q" not in exclude:
search = search.query("match", title=q)

return search

def order_queryset(self, queryset, exclude=None):
sort = self.cleaned_data.get("sort") or "-date"
if sort == "title":
sort = "title_keyword"
elif sort == "-title":
sort = "-title_keyword"
queryset = queryset.sort(sort, "title_keyword")
return queryset

def filter_faceted_search(self, search):
"""Add filters to a faceted search object, which is a bit different to adding them to the normal search
object."""
Expand Down
60 changes: 28 additions & 32 deletions africanlii/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-31 08:54+0300\n"
"POT-Creation-Date: 2024-07-17 09:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -134,7 +134,7 @@ msgid "For more information, visit the <a href=\"https://au.int/\" target=\"_bla
msgstr ""

#: templates/africanlii/au_detail_page.html:39
#: templates/africanlii/au_organ_detail.html:12
#: templates/africanlii/au_organ_detail.html:11
#: templates/peachjam/_header.html:78 templates/peachjam/home.html:64
msgid "African Union Organs"
msgstr ""
Expand All @@ -158,28 +158,24 @@ msgid "Member States"
msgstr ""

#: templates/africanlii/au_institution_detail.html:9
#: templates/africanlii/au_organ_detail.html:9
#: templates/africanlii/au_organ_detail.html:8
#: templates/africanlii/member_state_detail.html:9
#: templates/africanlii/regional_economic_community_detail.html:9
msgid "African Union"
msgstr ""

#: templates/africanlii/au_institution_detail.html:37
#: templates/africanlii/au_organ_detail.html:37
#: templates/africanlii/member_state_detail.html:38
#: templates/africanlii/regional_economic_community_detail.html:38
msgid "No documents found."
msgstr ""

#: templates/africanlii/doc_index_detail.html:8
#: templates/africanlii/doc_index_first_level.html:7
#: templates/africanlii/doc_indexes.html:4
#: templates/africanlii/doc_indexes.html:8
msgid "Indexes"
msgstr ""

#: templates/africanlii/member_state_detail.html:38
msgid "No documents found."
msgstr ""

#: templates/peachjam/_footer.html:5 templates/peachjam/_header.html:123
#: templates/peachjam/about.html:4
msgid "About"
msgstr ""

Expand All @@ -203,11 +199,11 @@ msgstr ""
msgid "With support from"
msgstr ""

#: templates/peachjam/_footer.html:44 templates/peachjam/_footer.html:138
#: templates/peachjam/_footer.html:44 templates/peachjam/_footer.html:144
msgid "European Union"
msgstr ""

#: templates/peachjam/_footer.html:49 templates/peachjam/_footer.html:151
#: templates/peachjam/_footer.html:49 templates/peachjam/_footer.html:157
#: templates/peachjam/_header.html:19
msgid "Open Law Africa"
msgstr ""
Expand All @@ -216,7 +212,7 @@ msgstr ""
msgid "Other African Legal Information Institutions"
msgstr ""

#: templates/peachjam/_footer.html:118
#: templates/peachjam/_footer.html:124
msgid "University of Cape Town"
msgstr ""

Expand Down Expand Up @@ -289,63 +285,63 @@ msgstr ""
msgid "Help"
msgstr ""

#: templates/peachjam/about.html:9
#: templates/peachjam/about.html:4
msgid "About the platform"
msgstr ""

#: templates/peachjam/about.html:11
#: templates/peachjam/about.html:8
msgid "This Pan-African platform serves as an information clearinghouse on all aspects of the African Governance Architecture (AGA) agenda, including charters, protocols, communications, relevant legal decisions, policy, implementation, monitoring, and related material. The overall objective is to build effective collaboration between African citizens and civil society organisations on the one hand, and AGA members on the other, to strengthen implementation of the AGA platform’s agenda with respect to democracy, governance, and human rights. Our specific goals are to:"
msgstr ""

#: templates/peachjam/about.html:22
#: templates/peachjam/about.html:19
msgid "Increase overall awareness of the AGA agenda and popular perceptions about democracy, governance and human rights among civil society organisations (CSOs) and AGA members"
msgstr ""

#: templates/peachjam/about.html:28
#: templates/peachjam/about.html:25
msgid "Supply complete, accurate and re-usable AGA information to allow AGA and CSOs to work towards shared goals"
msgstr ""

#: templates/peachjam/about.html:33
#: templates/peachjam/about.html:30
msgid "Capacitate civil society on all levels to access, interpret and effectively use AGA information"
msgstr ""

#: templates/peachjam/about.html:38
#: templates/peachjam/about.html:35
msgid "Strengthen monitoring, develop insights, and improve national-level implementation by developing linkages between regional and member-states’ law and policy."
msgstr ""

#: templates/peachjam/about.html:45
#: templates/peachjam/about.html:42
msgid "This platform is developed and maintained jointly by <a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> and <a href=\"https://laws.africa/\" target=\"_blank\">Laws.Africa</a> with funds from the European Union, the Indigo Trust and the Sigrid Rausing Trust. The initial phase of the project runs from 2021 to 2024."
msgstr ""

#: templates/peachjam/about.html:51
#: templates/peachjam/about.html:48
msgid "Platform developers"
msgstr ""

#: templates/peachjam/about.html:53
#: templates/peachjam/about.html:50
msgid "<a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> is a programme of the Democratic Governance and Rights Unit at the Department of Public Law, University of Cape Town. <a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> helps governments, academia and non-profit organisations publish the law of African countries for sustainable open access. <a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> hosts curated collections on various subjects of African law, such as human rights, the environment, commercial law and finance."
msgstr ""

#: templates/peachjam/about.html:61
#: templates/peachjam/about.html:58
msgid "<a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> convenes a network of 16 African LIIs - a collaborative group of governments, organizations, and individuals in Africa, dedicated to free access to law on our continent."
msgstr ""

#: templates/peachjam/about.html:67
#: templates/peachjam/about.html:64
msgid "<a href=\"https://laws.africa/\" target=\"_blank\">Laws.Africa</a> helps African governments to sustainably digitise their legal information for public use, through open law software, capacity-building, training, partnerships and support. <a href=\"https://laws.africa/\" target=\"_blank\">Laws.Africa’s</a> Open Law Technology solutions lower the cost of digitisation, archival and publication of primary legal information, and create opportunities for rich interactivity, advanced research and justice sector innovation."
msgstr ""

#: templates/peachjam/about.html:75
#: templates/peachjam/about.html:72
msgid "<a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> and <a href=\"https://laws.africa/\" target=\"_blank\">Laws.Africa</a> collaborate in unlocking the value of African digital legal information in support of the rule of law, access to justice, and innovation."
msgstr ""

#: templates/peachjam/about.html:80
#: templates/peachjam/about.html:77
msgid "Find out more"
msgstr ""

#: templates/peachjam/about.html:82
#: templates/peachjam/about.html:79
msgid "Visit <a href=\"https://openlawafrica.org/\" target=\"_blank\">openlawafrica.org</a> or contact us on <a href=\"mailto:[email protected]\">[email protected]</a> for more information."
msgstr ""

#: templates/peachjam/about.html:92
#: templates/peachjam/about.html:86
msgid "Our partners"
msgstr ""

Expand Down Expand Up @@ -443,15 +439,15 @@ msgstr ""
msgid "Search African legal information"
msgstr ""

#: templates/peachjam/home.html:188
#: templates/peachjam/home.html:190
msgid "Latest Commentary"
msgstr ""

#: templates/peachjam/home.html:191
#: templates/peachjam/home.html:193
msgid "View more commentary"
msgstr ""

#: templates/peachjam/home.html:197
#: templates/peachjam/home.html:199
msgid "Collections"
msgstr ""

Expand Down
Loading
Loading