Exemplo n.º 1
0
def context_processor(request):
    return {
        'user': request.user,
        'debug': settings.DEBUG,
        'claims': Claims.statistic(),
        }
Exemplo n.º 2
0
def claims_statistic(context):
    context['claims'] = Claims.statistic()
    return context
Exemplo n.º 3
-1
def index(request):
    CLAIM_STATUS_NEW = 1
    """ This function handles users' claims on spelling error.
    It saves all information into Claims model. It doesn't check
    the fields' length. """
    if request.is_ajax():
        record = Claims(
            ctx_left=request.POST.get("ctx_left", ""),
            selected=request.POST.get("selected", "None"),
            ctx_right=request.POST.get("ctx_right", ""),
            email=request.POST.get("email", "*****@*****.**"),
            status=CLAIM_STATUS_NEW,
            notify="true" == request.POST.get("notify", None),
            comment=request.POST.get("comment", "No comments..."),
            url=request.META.get("HTTP_REFERER", ""),
        )
        record.save()
        return HttpResponse("<result>ok</result>", mimetype="text/xml")
    else:
        return HttpResponse("<result>error</result>", mimetype="text/xml")