Exemple #1
0
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)
Exemple #2
0
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()
    )
Exemple #3
0
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()
    )
Exemple #4
0
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()
        ),
    )
Exemple #5
0
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))
    )
Exemple #6
0
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,
    )
Exemple #7
0
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
    )
Exemple #8
0
def page_not_found(error):
    return render('errors/404.html', error=error), 404
Exemple #9
0
 def render(self, context=None, **kwargs):
     context = context or self.get_context()
     context.update(kwargs)
     return render(self.template_name, **context)
Exemple #10
0
def show(post):
    return render('post/display.html', post=post)
Exemple #11
0
def list_posts():
    return render('post/list.html', posts=Post.objects.order_by('-created_at'))
Exemple #12
0
def map():
    return render('site/map.html')
Exemple #13
0
def page_not_found(error):
    return render('404.html'), 404
Exemple #14
0
def apidoc():
    return render('apidoc.html', api_endpoint=api.endpoint, specs_url=api.specs_url)
Exemple #15
0
def internal_error(error):
    return render('errors/500.html', error=error), 500
Exemple #16
0
def forbidden(error):
    return render('errors/403.html', error=error), 403
Exemple #17
0
def home():
    context = {}
    processor = theme.current.get_processor('home', default_home_context_processor)
    return render('home.html', **processor(context))