(num, model, **kwargs)
return num
自动返回编号的最大值
自动返回编号的最大值
自动返回编号的最大值
def auto_num(num, model, **kwargs):
    """自动返回编号的最大值"""
    if not num:
        if not model.query.filter_by(**kwargs).all():
            return 1
        else:
            return model.query.filter_by(**kwargs).order_by(model.num.desc()).first().num + 1
    return num
def auto_num ( num , model , * * kwargs ) : if not num : if not model . query . filter_by ( * * kwargs ) . all ( ) : return 1 else : return model . query . filter_by ( * * kwargs ) . order_by ( model . num . desc ( ) ) . first ( ) . num + 1 return num