Ejemplo n.º 1
0
def map_feature_detail(request,
                       instance,
                       feature_id,
                       render=False,
                       edit=False):
    feature = get_map_feature_or_404(feature_id, instance)

    ctx_fn = (context_dict_for_plot
              if feature.is_plot else context_dict_for_resource)
    context = ctx_fn(request, feature, edit=edit)
    add_map_info_to_context(context, instance)

    if render:
        if feature.is_plot:
            template = 'treemap/plot_detail.html'
        else:
            app = feature.__module__.split('.')[0]
            try:
                template = '%s/%s_detail.html' % (app, feature.feature_type)
                get_template(template)
            except TemplateDoesNotExist:
                template = 'treemap/resource_detail.html'
        return render_to_response(template, context, RequestContext(request))
    else:
        return context
Ejemplo n.º 2
0
def map_feature_detail(request, instance, feature_id,
                       render=False, edit=False):
    context, partial = _map_feature_detail_context(
        request, instance, feature_id, edit)
    add_map_info_to_context(context, instance)

    if render:
        template = 'treemap/map_feature_detail.html'
        context['map_feature_partial'] = partial
        return render_to_response(template, context, RequestContext(request))
    else:
        return context
Ejemplo n.º 3
0
def map_feature_detail(request, instance, feature_id,
                       render=False, edit=False):
    context, partial = _map_feature_detail_context(
        request, instance, feature_id, edit)
    add_map_info_to_context(context, instance)

    if render:
        template = 'treemap/map_feature_detail.html'
        context['map_feature_partial'] = partial
        return render_to_response(template, context, RequestContext(request))
    else:
        return context
Ejemplo n.º 4
0
def map_feature_detail(request, instance, feature_id,
                       should_render=False, edit=False):
    context, partial = _map_feature_detail_context(
        request, instance, feature_id, edit)
    add_map_info_to_context(context, instance)

    if should_render:
        template = 'treemap/map_feature_detail.html'
        context['map_feature_partial'] = partial
        latlon = context['feature'].latlon
        context['map_query'] = '?z=%s/%s/%s' % (18, latlon.y, latlon.x)
        return render(request, template, context)
    else:
        return context
Ejemplo n.º 5
0
def map_feature_detail(request, instance, feature_id,
                       should_render=False, edit=False):
    context, partial = _map_feature_detail_context(
        request, instance, feature_id, edit)
    add_map_info_to_context(context, instance)

    if should_render:
        template = 'treemap/map_feature_detail.html'
        context['map_feature_partial'] = partial
        latlon = context['feature'].latlon
        context['map_query'] = '?z=%s/%s/%s' % (18, latlon.y, latlon.x)
        return render(request, template, context)
    else:
        return context
Ejemplo n.º 6
0
def map_feature_detail(request, instance, feature_id, render=False, edit=False):
    feature = get_map_feature_or_404(feature_id, instance)

    ctx_fn = context_dict_for_plot if feature.is_plot else context_dict_for_resource
    context = ctx_fn(request, feature, edit=edit)
    add_map_info_to_context(context, instance)

    if render:
        if feature.is_plot:
            template = "treemap/plot_detail.html"
        else:
            app = feature.__module__.split(".")[0]
            template = "%s/%s_detail.html" % (app, feature.feature_type)
        return render_to_response(template, context, RequestContext(request))
    else:
        return context
Ejemplo n.º 7
0
def map_feature_detail(request, instance, feature_id,
                       render=False, edit=False):
    feature = get_map_feature_or_404(feature_id, instance)

    ctx_fn = (context_dict_for_plot if feature.is_plot
              else context_dict_for_resource)
    context = ctx_fn(request, feature, edit=edit)
    add_map_info_to_context(context, instance)

    if render:
        if feature.is_plot:
            template = 'treemap/plot_detail.html'
        else:
            app = feature.__module__.split('.')[0]
            try:
                template = '%s/%s_detail.html' % (app, feature.feature_type)
                get_template(template)
            except TemplateDoesNotExist:
                template = 'treemap/resource_detail.html'
        return render_to_response(template, context,
                                  RequestContext(request))
    else:
        return context