Ejemplo n.º 1
0
def setup_activity(request):
    """Display page 5 (activity) of the first login wizard."""

    activity = smartgrid.get_setup_activity()

    if request.is_ajax():
        template = render_to_string("first-login/activity.html", {'activity': activity},
            context_instance=RequestContext(request))

        response = HttpResponse(json.dumps({
            "title": "Introduction: Step 5 of 7",
            "contents": template,
            }), mimetype='application/json')

        return response

    else:
        template = render_to_string("first-login/activity.html", {'activity': activity},
            context_instance=RequestContext(request))

        response = HttpResponse("<textarea>" + json.dumps({
            "title": "Introduction: Step 5 of 7",
            "contents": cgi.escape(template),
            }) + "</textarea>", mimetype='text/html')

        return response
Ejemplo n.º 2
0
def setup_activity(request):
    """Display page 5 (activity) of the first login wizard."""

    activity = smartgrid.get_setup_activity()

    if request.is_ajax():
        template = render_to_string("first-login/activity.html", {'activity': activity},
            context_instance=RequestContext(request))

        response = HttpResponse(json.dumps({
            "title": "Introduction: Step 5 of 7",
            "contents": template,
            }), mimetype='application/json')

        return response

    else:
        template = render_to_string("first-login/activity.html", {'activity': activity},
            context_instance=RequestContext(request))

        response = HttpResponse("<textarea>" + json.dumps({
            "title": "Introduction: Step 5 of 7",
            "contents": cgi.escape(template),
            }) + "</textarea>", mimetype='text/html')

        return response
Ejemplo n.º 3
0
def setup_question(request):
    """Display page 6 (activity question) of the first login wizard."""

    if request.is_ajax():
        template = render_to_string("first-login/question.html", {},
            context_instance=RequestContext(request))
        activity = smartgrid.get_setup_activity()
        points = str(activity.point_value) + " points"

        response = HttpResponse(json.dumps({
            "title": "Introduction: Step 6 of 7",
            "contents": template,
            "points": points,
            }), mimetype='application/json')

        return response
    raise Http404
Ejemplo n.º 4
0
def setup_question(request):
    """Display page 6 (activity question) of the first login wizard."""

    if request.is_ajax():
        template = render_to_string("first-login/question.html", {},
            context_instance=RequestContext(request))
        activity = smartgrid.get_setup_activity()
        points = str(activity.point_value) + " points"

        response = HttpResponse(json.dumps({
            "title": "Introduction: Step 6 of 7",
            "contents": template,
            "points": points,
            }), mimetype='application/json')

        return response
    raise Http404
Ejemplo n.º 5
0
def supply(request, page_name):
    """ supply view_objects for widget rendering."""
    _ = request
    _ = page_name
    video_action = smartgrid.get_setup_activity()
    return {"video_action": video_action}