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('/')
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('/')
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('/')
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('/')