示例#1
0
def delete(request):
    p = PaymentType(pk=request.REQUEST['id'])
    try:
        p.delete()
        data = '{"success":true}'
    except Exception, e1:
        data = '{"success":false, "msg": "%s"}' % (e1.args)
示例#2
0
def update(request):
    p = PaymentType(pk=request.REQUEST['id'],name=request.REQUEST['name'])
    data = '{"success":true}'
    try:
        p.save()
    except IntegrityError:
        data = '{"success":false, "msg": "%s"}' % (_("Payment Type '%s' already exists.") % (req['name']))
    except _mysql_exceptions.Warning:
        pass
    except Exception, e1:
        data = '{"success":false, "msg": "%s"}' % (e1.args)