示例#1
0
import treemap.views.misc as misc_views
import treemap.views.map_feature as feature_views

add_map_feature_photo_do = partial(
    do, require_http_method("POST"), login_or_401, instance_request,
    creates_instance_user,
    render_template('treemap/partials/photo_carousel.html'))

#####################################
# misc content views
#####################################

edits_page = do(instance_request, requires_feature('recent_edits_report'),
                render_template('treemap/edits.html'), misc_views.edits)

index_page = instance_request(misc_views.index)

map_page = do(instance_request, render_template('treemap/map.html'),
              misc_views.get_map_view_context)

static_page = do(instance_request, render_template('treemap/staticpage.html'),
                 misc_views.static_page)

instance_not_available = render_template(
    'treemap/instance_not_available.html')()

landing_page = render_template('base.html')()

unsupported_page = render_template('treemap/unsupported.html')()

instances_geojson = do(json_api_call, misc_views.public_instances_geojson)
示例#2
0
            "Plot %s does not have a current tree" % plot_id)


def add_photo(request, instance, plot_id):
    treephoto, _ = add_tree_photo(request, instance, plot_id)

    return treephoto


# Note that API requests going to private instances require
# authentication "login_optional" before they can access they
# instance data

plots_closest_to_point_endpoint = check_signature(
    instance_request(
        json_api_call(
            plots_closest_to_point)))

instances_closest_to_point_endpoint = check_signature(
    instance_request(
        json_api_call(
            instances_closest_to_point)))

instance_info_endpoint = check_signature(
    instance_request(
        json_api_call(
            instance_info)))

plots_endpoint = check_signature(
    instance_request(
        json_api_call(
示例#3
0
    login_or_401,
    instance_request,
    creates_instance_user,
    render_template('treemap/partials/photo_carousel.html'))

#####################################
# misc content views
#####################################

edits_page = do(
    instance_request,
    requires_feature('recent_edits_report'),
    render_template('treemap/edits.html'),
    misc_views.edits)

index_page = instance_request(misc_views.index)

map_page = do(
    instance_request,
    render_template('treemap/map.html'),
    misc_views.get_map_view_context)

static_page = do(
    instance_request,
    render_template('treemap/staticpage.html'),
    misc_views.static_page)

instance_not_available = render_template(
    'treemap/instance_not_available.html')()

landing_page = render_template('base.html')()
示例#4
0
文件: views.py 项目: danmcginnis/OTM2
    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)))
示例#5
0
文件: __init__.py 项目: gapb/OTM2
    delete_map_feature, map_feature_popup, add_map_feature, map_feature_hash,
    rotate_map_feature_photo, add_map_feature_photo)

add_map_feature_photo_do = partial(
    do, require_http_method("POST"), login_or_401, instance_request,
    creates_instance_user,
    render_template('treemap/partials/photo_carousel.html'))

#####################################
# misc content views
#####################################

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

index_view = instance_request(index)

map_view = do(instance_request, render_template('treemap/map.html'),
              get_map_view_context)

static_page_view = do(instance_request,
                      render_template('treemap/staticpage.html'), static_page)

instance_not_available_view = render_template(
    'treemap/instance_not_available.html')()

landing_view = render_template('base.html')()

unsupported_view = render_template('treemap/unsupported.html')()

instances_geojson_view = do(json_api_call, public_instances_geojson)
示例#6
0
文件: views.py 项目: heath/OTM2
        user = users[0]

        password_reset_url = request.build_absolute_uri(
            reverse('auth_password_reset'))

        subject = trans('Account Recovery')
        body = render_to_string('treemap/partials/forgot_username_email.txt',
                                {'user': user,
                                 'password_url': password_reset_url})

        user.email_user(subject, body, settings.DEFAULT_FROM_EMAIL)

    return {'email': user_email}


tree_detail_view = instance_request(tree_detail)

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_map_feature_detail_view = instance_request(render_map_feature_detail)

get_map_feature_add_view = instance_request(render_map_feature_add)

edit_plot_detail_view = login_required(
示例#7
0
文件: __init__.py 项目: atogle/OTM2
    login_or_401,
    instance_request,
    creates_instance_user,
    render_template('treemap/partials/photo_carousel.html'))

#####################################
# misc content views
#####################################

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

index_view = instance_request(index)

map_view = do(
    instance_request,
    render_template('treemap/map.html'),
    get_map_view_context)

static_page_view = do(
    instance_request,
    render_template('treemap/staticpage.html'),
    static_page)

instance_not_available_view = render_template(
    'treemap/instance_not_available.html')()

landing_view = render_template('base.html')()
示例#8
0
                updated_plot,
                user=request.user,
                supports_eco=request.instance_supports_ecobenefits)
        except:
            raise PermissionDenied(
                '%s does not have permission to the '
                'current tree from plot %s' %
                (request.user.username, plot_id))
    else:
        raise HttpResponseBadRequest(
            "Plot %s does not have a current tree" % plot_id)


plots_closest_to_point_endpoint = login_optional(
    instance_request(
        csrf_exempt(json_api_call(
            plots_closest_to_point))))

instances_closest_to_point_endpoint = login_optional(
    instance_request(
        csrf_exempt(json_api_call(
            instances_closest_to_point))))

instance_info_endpoint = login_optional(
    instance_request(
        csrf_exempt(json_api_call(
            instance_info))))

login_endpoint = csrf_exempt(
    json_api_call(login_required(user_info)))