Example #1
0
    return {'start_status': 'OK', 'job_id': job.pk}


def check_export(request, instance, job_id):

    job = get_object_or_404(ExportJob, pk=job_id)

    # if a job has a user, it means the user must
    # be authenticated so only the job user can
    # retrieve the export
    if job.user and job.user != request.user:
        return {'status': 'ERROR',
                'message': 'Job not initiated by user',
                'url': None}

    else:
        return {'status': ExportJob.STATUS_STRINGS[job.status],
                'message': ExportJob.STATUS_CHOICES[job.status],
                'url': job.get_url_if_ready()}


begin_export_endpoint = json_api_call(
    instance_request(
        requires_feature('exports')(
            begin_export)))
check_export_endpoint = json_api_call(
    instance_request(
        requires_feature('exports')(
            check_export)))
Example #2
0
    #       the same string. In the future, they'll grab
    #       from the instance config

    allowed_pages = ["Resources", "FAQ", "About"]

    if page not in allowed_pages:
        raise Http404()

    return {"content": trans("There is no content for this page yet"), "title": page}


def index(request, instance):
    return HttpResponseRedirect(reverse("map", kwargs={"instance_url_name": instance.url_name}))


edits_view = instance_request(requires_feature("recent_edits_report")(render_template("treemap/edits.html", edits)))

index_view = instance_request(index)

map_view = instance_request(render_template("treemap/map.html", _get_map_view_context))

get_plot_detail_view = instance_request(render_template("treemap/plot_detail.html", plot_detail))

edit_plot_detail_view = login_required(
    instance_request(creates_instance_user(render_template("treemap/plot_detail.html", plot_detail)))
)

get_plot_eco_view = instance_request(etag(_plot_hash)(render_template("treemap/partials/plot_eco.html", plot_detail)))

get_plot_sidebar_view = instance_request(
    etag(_plot_hash)(render_template("treemap/partials/sidebar.html", plot_detail))