def search(): datasets, organizations, reuses = multiquery( SearchQuery(DatasetSearch, **multi_to_dict(request.args)), SearchQuery(OrganizationSearch, **multi_to_dict(request.args)), SearchQuery(ReuseSearch, **multi_to_dict(request.args)), ) return render("search.html", datasets=datasets, organizations=organizations, reuses=reuses)
def reuses(topic): kwargs = multi_to_dict(request.args) kwargs.update(topic=topic) return render('topic/reuses.html', topic=topic, reuses=TopicSearchQuery(Reuse, facets=True, **kwargs).execute() )
def datasets(topic): kwargs = multi_to_dict(request.args) kwargs.update(topic=topic) return render('topic/datasets.html', topic=topic, datasets=TopicSearchQuery(Dataset, facets=True, **kwargs).execute() )
def metrics(): metrics = Metrics.objects.last_for("site") specs = Metric.get_for("site") values = metrics.values if metrics else {} return render( "metrics.html", metrics=dict( (key, {"value": values.get(key, spec.default), "label": spec.display_name}) for key, spec in specs.items() ), )
def display(topic): specs = { 'recent_datasets': TopicSearchQuery(Dataset, sort='-created', page_size=9, topic=topic), 'featured_reuses': TopicSearchQuery(Reuse, featured=True, page_size=6, topic=topic), } keys, queries = zip(*specs.items()) results = search.multiquery(*queries) return render('topic/display.html', topic=topic, **dict(zip(keys, results)) )
def display(topic): kwargs = multi_to_dict(request.args) kwargs.update(topic=topic) datasets, reuses = multiquery( TopicSearchQuery(DatasetSearch, **kwargs), TopicSearchQuery(ReuseSearch, **kwargs), ) return render('topic/display.html', topic=topic, datasets=datasets, reuses=reuses, )
def render_search(): params = multi_to_dict(request.args) params['facets'] = True datasets, organizations, reuses, users = search.multiquery( search.SearchQuery(Dataset, **params), search.SearchQuery(Organization, **params), search.SearchQuery(Reuse, **params), search.SearchQuery(User, **params), ) return render('search.html', datasets=datasets, organizations=organizations, reuses=reuses, users=users )
def page_not_found(error): return render('errors/404.html', error=error), 404
def render(self, context=None, **kwargs): context = context or self.get_context() context.update(kwargs) return render(self.template_name, **context)
def show(post): return render('post/display.html', post=post)
def list_posts(): return render('post/list.html', posts=Post.objects.order_by('-created_at'))
def map(): return render('site/map.html')
def page_not_found(error): return render('404.html'), 404
def apidoc(): return render('apidoc.html', api_endpoint=api.endpoint, specs_url=api.specs_url)
def internal_error(error): return render('errors/500.html', error=error), 500
def forbidden(error): return render('errors/403.html', error=error), 403
def home(): context = {} processor = theme.current.get_processor('home', default_home_context_processor) return render('home.html', **processor(context))