def delete(request): p = CardData(pk=request.REQUEST['id']) try: p.delete() data = '{"success":true}' except Exception, e1: data = '{"success":false, "msg": "%s"}' % (e1.args)
def fromParams(req): if param_exist("id",req): e = CardData(pk=req['id']) else: e = CardData() c = Card(pk=req['card.id']) e.date=DateService.invert(req['date']) e.shop=req['shop'] e.instalments=req['instalments'] e.total=req['total'] e.card = c return e