コード例 #1
0
ファイル: controller.py プロジェクト: Forkong/Xianzhi
def single_good_add(pars):
    condition = fun.warp_data(pars)
    condition['create_date'] = fun.now()
    del condition['id']
    print 'condition = ', condition
    try:
        g = Good(**condition)
        g.save()
        return True
    except Exception as e:
        print e
        return False
コード例 #2
0
def single_good_add(pars):
    condition = fun.warp_data(pars)
    condition['create_date'] = fun.now()
    del condition['id']
    print 'condition = ', condition
    try:
        g = Good(**condition)
        g.save()
        return True
    except Exception as e:
        print e
        return False
コード例 #3
0
def user_register(pars):
    if pars['passwd'] != pars['repasswd']:
        return -1
    condition = fun.warp_data(pars)
    del condition['repasswd']
    condition['create_date'] = fun.now()
    condition['passwd'] = fun.mk_md5(condition['passwd'])
    print 'condition = ', condition
    try:
        r = User.objects.get(email=condition['email'])
        if r:
            return -2
    except User.DoesNotExist:
        try:
            u = User(**condition)
            u.save()
            if u.name:
                return 1
            else:
                return -3
        except:
            return -2
コード例 #4
0
ファイル: controller.py プロジェクト: Forkong/Xianzhi
def user_register(pars):
    if pars['passwd']!=pars['repasswd']:
        return -1
    condition = fun.warp_data(pars)
    del condition['repasswd']
    condition['create_date'] = fun.now()
    condition['passwd'] = fun.mk_md5(condition['passwd'])
    print 'condition = ',condition
    try:
        r = User.objects.get(email=condition['email'])
        if r:
            return -2
    except User.DoesNotExist:
        try:
            u = User(**condition)
            u.save()
            if u.name:
                return 1
            else:
                return -3
        except:
            return -2