Ejemplo n.º 1
0
def survey(request, survey_slug=None, template='survey/survey.html'):
    if request.GET.get('id', None) is not None and request.GET.get(
            'return', None) is not None:
        survey = get_object_or_404(
            Survey, slug='puget-sound-coastal-recreation-survey', anon=True)
        respondant, created = Respondant.objects.get_or_create(
            survey=survey, uuid=request.GET.get('id'))
        respondant.gfk_returnURL = request.GET.get('return')
        respondant.save()
        return redirect(
            "/respond#/survey/puget-sound-coastal-recreation-survey/%s" %
            (respondant.uuid))
    elif survey_slug is not None:
        survey = get_object_or_404(Survey, slug=survey_slug, anon=True)
        respondant = Respondant(survey=survey)
        respondant.save()
        if request.GET.get('get-uid', None) is not None:
            return HttpResponse(
                simplejson.dumps({
                    'success': "true",
                    "uuid": respondant.uuid
                }))
        return redirect("/respond#/survey/%s/%s" %
                        (survey.slug, respondant.uuid))
    context = {'ANALYTICS_ID': settings.ANALYTICS_ID}
    return render_to_response(template, RequestContext(request, context))
Ejemplo n.º 2
0
def survey(request, survey_slug=None, template='survey/survey.html'):
    if survey_slug is not None:
        survey = get_object_or_404(Survey, slug=survey_slug, anon=True)
        respondant = Respondant(survey=survey)
        respondant.save()
        if request.GET.get('get-uid', None) is not None:
            return HttpResponse(simplejson.dumps({'success': "true", "uuid": respondant.uuid}))
        return redirect("/respond#/survey/%s/%s" % (survey.slug, respondant.uuid))
    return render_to_response(template, RequestContext(request, {}))
Ejemplo n.º 3
0
def survey(request, survey_slug=None, template='survey/survey.html'):
    if survey_slug is not None:
        survey = get_object_or_404(Survey, slug=survey_slug, anon=True)
        respondant = Respondant(survey=survey, user=request.user)
        respondant.save()
        if request.GET.get('get-uid', None) is not None:
            return HttpResponse(simplejson.dumps({'success': "true", "uuid": respondant.uuid}))
        return redirect("/respond#/survey/%s/0/%s/landing" % (survey.slug, respondant.uuid))
    context = {'ANALYTICS_ID': settings.ANALYTICS_ID}
    return render_to_response(template, RequestContext(request, context))
Ejemplo n.º 4
0
def dash(request, survey_slug=None, template='survey/dash.html'):
    if survey_slug is not None:
        survey = get_object_or_404(Survey, slug=survey_slug, anon=True)
        respondant = Respondant(survey=survey)
        respondant.save()
        if request.GET.get('get-uid', None) is not None:
            return HttpResponse(simplejson.dumps({'success': "true", "uuid": respondant.uuid}))
        return redirect("/respond#/survey/%s/%s" % (survey.slug, respondant.uuid))

    return render_to_response(template, RequestContext(request, {'api_key': request.user.api_key.key}))
Ejemplo n.º 5
0
def survey(request, survey_slug=None, template='survey/survey.html'):
    if survey_slug is not None:
        survey = get_object_or_404(Survey, slug=survey_slug, anon=True)
        respondant = Respondant(survey=survey, surveyor=request.user)
        respondant.save()
        if request.GET.get('get-uid', None) is not None:
            return HttpResponse(simplejson.dumps({'success': "true", "uuid": respondant.uuid}))
        return redirect("/respond#/survey/%s/%s" % (survey.slug, respondant.uuid))
    context = {'ANALYTICS_ID': settings.ANALYTICS_ID}
    return render_to_response(template, RequestContext(request, context))
Ejemplo n.º 6
0
def survey(request, survey_slug=None, template='survey/survey.html'):
    if request.GET.get('id', None) is not None and request.GET.get('return', None) is not None:
        survey = get_object_or_404(Survey, slug='puget-sound-coastal-recreation-survey', anon=True)
        respondant, created = Respondant.objects.get_or_create(survey=survey, uuid=request.GET.get('id'))
        respondant.gfk_returnURL = request.GET.get('return')
        respondant.save()
        return redirect("/respond#/survey/puget-sound-coastal-recreation-survey/%s" % (respondant.uuid))
    elif survey_slug is not None:
        survey = get_object_or_404(Survey, slug=survey_slug, anon=True)
        respondant = Respondant(survey=survey)
        respondant.save()
        if request.GET.get('get-uid', None) is not None:
            return HttpResponse(simplejson.dumps({'success': "true", "uuid": respondant.uuid}))
        return redirect("/respond#/survey/%s/%s" % (survey.slug, respondant.uuid))
    context = {'ANALYTICS_ID': settings.ANALYTICS_ID}
    return render_to_response(template, RequestContext(request, context))