From deb7caad87b4a3170564a0ed2bfbf2eee855e788 Mon Sep 17 00:00:00 2001 From: Mojib Wali <44528277+mb-wali@users.noreply.github.com> Date: Thu, 15 Oct 2020 11:34:55 +0200 Subject: [PATCH] migrate:upon the changes to the datamodel. modified the frontpage to render the latest datamodel schema. --- invenio_theme_tugraz/search.py | 4 ++-- .../templates/invenio_theme_tugraz/index.html | 14 +++++++------- invenio_theme_tugraz/views.py | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/invenio_theme_tugraz/search.py b/invenio_theme_tugraz/search.py index 020d812..e256c02 100644 --- a/invenio_theme_tugraz/search.py +++ b/invenio_theme_tugraz/search.py @@ -21,5 +21,5 @@ class FrontpageRecordsSearch(RecordsSearch): class Meta: """Default index and filter for frontpage search.""" - index = "records" - default_filter = Q("query_string", query=("access_right:open ")) + index = "rdmrecords" + default_filter = Q("query_string", query=("access.access_right:open")) diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html index 06a5fe1..c299ed7 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html @@ -41,7 +41,7 @@ {%- for r in records %} {%- set creation_date = r._created|from_isodatetime -%} - {%- set record_url = url_for('invenio_records_ui.recid', pid_value=r['recid']) %} + {%- set record_url = url_for('invenio_records_ui.recid', pid_value=r['id']) %}
- {{ r.publication_date }} + {{ r.metadata.publication_date }} @@ -60,7 +60,7 @@ - {{r.resource_type | cast_to_dict | vocabulary_title('resource_type') }} + {{r.metadata.resource_type | cast_to_dict | vocabulary_title('resource_type') }} @@ -70,17 +70,17 @@

- {{r.titles[0].title}} + {{r.metadata.titles[0].title}}

- {{ creators(r.creators) }} + {{ creators(r.metadata.creators) }}

@@ -96,7 +96,7 @@
- {{ r.access_right | make_dict_like('access_right') | vocabulary_title('access_right') | lower }} + {{ r.access.access_right | make_dict_like('access_right') | vocabulary_title('access_right') | lower }}
diff --git a/invenio_theme_tugraz/views.py b/invenio_theme_tugraz/views.py index 1faba76..bcad55b 100644 --- a/invenio_theme_tugraz/views.py +++ b/invenio_theme_tugraz/views.py @@ -28,7 +28,7 @@ def index(): """Render frontpage view.""" return render_template( "invenio_theme_tugraz/index.html", - records=FrontpageRecordsSearch()[:5].sort("-_created").execute(), + records=FrontpageRecordsSearch()[:5].sort("-created").execute(), ) # pragma: no cover