Получите предел организаций на экране (CKAN)Html

Программисты Html
Ответить
Anonymous
 Получите предел организаций на экране (CKAN)

Сообщение Anonymous »

Я разрабатываю тему на CKAN (вдохновленная https://data.gov.sg/), и я пытаюсь отобразить свои организации в картах на моем index.html (см. Изображение и не возражайте, ошибки дизайна: p) изображение карт
Я написал контроллер, который возвращается на даты на экране. Я отобразите коды здесь и ценю, если вы можете мне помочь!import ckan.lib.base as base
from pylons import c

class HomeController(base.BaseController):
def index(self):
context = {'ignore_auth': True}

datasets = toolkit.get_action('package_search')(context, {'rows': 6})['results']

organizations = toolkit.get_action('organization_list')(context, {
'all_fields': True,
'include_dataset_count': True,
'limit': 100
})

return base.render('home/index.html', extra_vars={
'datasets': datasets,
'organizations': organizations
})
< /code>
Блок набора данных вызывается по адресу index.html < /p>
{% block dataset_container %}


5.0K+ datasets from 70 government agencies



Organizations

{% for org in organizations %}


{% if org.image_display_url %}

{% endif %}
{{ org.title }}
{{ org.description[:100] }}{% if org.description|length > 100 %}...{% endif %}


{% endfor %}



Latest Datasets

{% for dataset in c.datasets %}


{% if dataset.organization and dataset.organization.image_url %}
Изображение
{% endif %}
{{ dataset.title }}
{{ dataset.notes[:100] }}{% if dataset.notes|length > 100 %}...{% endif %}
1.2M API CALLS • 4.5K DOWNLOADS


{% endfor %}



View all datasets





{% endblock %}

< /code>
plugin.py: < /p>
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit

# import ckanext.almavivasolutionss.cli as cli
# import ckanext.almavivasolutionss.helpers as helpers
# import ckanext.almavivasolutionss.views as views
# from ckanext.almavivasolutionss.logic import (
# action, auth, validators
# )

class AlmavivasolutionssPlugin(plugins.SingletonPlugin):
plugins.implements(plugins.IConfigurer)

# plugins.implements(plugins.IAuthFunctions)
# plugins.implements(plugins.IActions)
# plugins.implements(plugins.IBlueprint)
# plugins.implements(plugins.IClick)
# plugins.implements(plugins.ITemplateHelpers)
# plugins.implements(plugins.IValidators)

# IConfigurer

def update_config(self, config_):
toolkit.add_template_directory(config_, "templates")
toolkit.add_public_directory(config_, "public")
toolkit.add_resource("assets", "almavivasolutionss")

def before_map(self, map):
from ckan.config.routing import SubMapper
controller = 'ckanext.almavivasolutionss.controllers.home:HomeController'

with SubMapper(map, controller=controller) as m:
m.connect('/', action='index')

return map

# IAuthFunctions

# def get_auth_functions(self):
# return auth.get_auth_functions()

# IActions

# def get_actions(self):
# return action.get_actions()

# IBlueprint

# def get_blueprint(self):
# return views.get_blueprints()

# IClick

# def get_commands(self):
# return cli.get_commands()

# ITemplateHelpers

# def get_helpers(self):
# return helpers.get_helpers()

# IValidators

# def get_validators(self):
# return validators.get_validators()

< /code>
Я что -то упускаю? Я пробовал отладывать и разные коды на home.py, но ничего не получилось. Я сейчас изучаю CKAN, так что я не эксперт
Заранее спасибо!

Подробнее здесь: https://stackoverflow.com/questions/796 ... creen-ckan
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Html»