Example #1
0
def delete(request):
    p = Debits(pk=request.REQUEST["id"])
    try:
        p.delete()
        data = '{"success":true}'
    except Exception, e1:
        data = '{"success":false, "msg": "%s"}' % (e1.args)
Example #2
0
def req_to_obj(request):
    req = request.REQUEST
    if req.has_key("id"):
        obj = Debits.objects.get(pk=req["id"])
    else:
        obj = Debits()
    obj.day = req["day"]
    obj.subCategory = SubCategory.objects.get(pk=req["subCategory.id"])
    obj.paymentType = PaymentType.objects.get(pk=req["paymentType.id"])
    obj.text = req["text"]
    obj.amount = req["amount"]
    obj.since = DateService.invert(req["since"])
    return obj