예제 #1
0
def delete_xform(request, username, id_string):
    xform = get_object_or_404(XForm,
                              user__username__iexact=username,
                              id_string__exact=id_string)

    # delete xform and submissions
    remove_xform(xform)

    audit = {}
    audit_log(
        Actions.FORM_DELETED, request.user, xform.user,
        _("Deleted form '%(id_string)s'.") % {
            'id_string': xform.id_string,
        }, audit, request)
    return HttpResponseRedirect('/')
예제 #2
0
파일: views.py 프로젝트: cagulas/onadata
def delete_xform(request, username, id_string):
    xform = get_object_or_404(XForm, user__username=username,
                              id_string=id_string)

    # delete xform and submissions
    remove_xform(xform)

    audit = {}
    audit_log(
        Actions.FORM_DELETED, request.user, xform.user,
        _("Deleted form '%(id_string)s'.") %
        {
            'id_string': xform.id_string,
        }, audit, request)
    return HttpResponseRedirect('/')
예제 #3
0
def delete_xform(request, username, id_string):
    try:
        xform = get_object_or_404(XForm,
                                  user__username__iexact=username,
                                  id_string__iexact=id_string)
    except MultipleObjectsReturned:
        return HttpResponse("Your account has multiple forms with same formid")

    # delete xform and submissions
    remove_xform(xform)

    audit = {}
    audit_log(
        Actions.FORM_DELETED, request.user, xform.user,
        _("Deleted form '%(id_string)s'.") % {
            'id_string': xform.id_string,
        }, audit, request)
    return HttpResponseRedirect('/')
예제 #4
0
def delete_xform(request, username, id_string):
    try:
        xform = get_object_or_404(XForm, user__username__iexact=username,
                                  id_string__iexact=id_string)
    except MultipleObjectsReturned:
        return HttpResponse("Your account has multiple forms with same formid")

    # delete xform and submissions
    remove_xform(xform)

    audit = {}
    audit_log(
        Actions.FORM_DELETED, request.user, xform.user,
        _("Deleted form '%(id_string)s'.") %
        {
            'id_string': xform.id_string,
        }, audit, request)
    return HttpResponseRedirect('/')
예제 #5
0
파일: views.py 프로젝트: onaio/onadata
def delete_xform(request, username, id_string):
    """
    Delete XForm view.
    """
    xform = get_form({
        'user__username__iexact': username,
        'id_string__iexact': id_string
    })

    # delete xform and submissions
    remove_xform(xform)

    audit = {}
    audit_log(Actions.FORM_DELETED, request.user, xform.user,
              _("Deleted form '%(id_string)s'.") % {
                  'id_string': xform.id_string,
              }, audit, request)
    return HttpResponseRedirect('/')
예제 #6
0
파일: views.py 프로젝트: s-chand/onadata
def delete_xform(request, username, id_string):
    """
    Delete XForm view.
    """
    xform = get_form({
        'user__username__iexact': username,
        'id_string__iexact': id_string
    })

    # delete xform and submissions
    remove_xform(xform)

    audit = {}
    audit_log(Actions.FORM_DELETED, request.user, xform.user,
              _("Deleted form '%(id_string)s'.") % {
                  'id_string': xform.id_string,
              }, audit, request)
    return HttpResponseRedirect('/')