FCSCOpendata / ckanext-fcscopendata

Theming extension for fcsc opendata platform
GNU Affero General Public License v3.0
0 stars 2 forks source link

Code refractor and only add bilingual fields if search action is called via API #57

Closed sagargg closed 2 years ago

sagargg commented 2 years ago

Fix for https://github.com/FCSCOpendata/fcsc-deploy/issues/20

This PR includes the following changes.

Note: Following patch needs to be added, otherwise it wouldn’t work properly.

diff --git a/ckan/views/dataset.py b/ckan/views/dataset.py
index e057dcaab..05b639dc4 100644
--- a/ckan/views/dataset.py
+++ b/ckan/views/dataset.py
@@ -312,6 +312,7 @@ def search(package_type):
             config.get(u'ckan.search.default_include_private', True)
         ),
     }
+    context['request_from_ui'] = True
     try:
         query = get_action(u'package_search')(context, data_dict)

diff --git a/ckan/views/user.py b/ckan/views/user.py
index b94324232..8ba22262b 100644
--- a/ckan/views/user.py
+++ b/ckan/views/user.py
@@ -53,6 +53,7 @@ def _new_form_to_db_schema():

 def _extra_template_variables(context, data_dict):
+    context['request_from_ui'] = True
     is_sysadmin = authz.is_sysadmin(g.user)
     try:
         user_dict = logic.get_action(u'user_show')(context, data_dict)