def delete(uid): ''' Delete by uid :param uid: :return: ''' q_u1 = TabPostHist.delete().where(TabPostHist.post_id == uid) q_u1.execute() q_u2 = TabRel.delete().where(TabRel.post_f_id == uid or TabRel.post_t_id == uid) q_u2.execute() q_u3 = TabCollect.delete().where(TabCollect.post_id == uid) q_u3.execute() q_u4 = TabPost2Tag.delete().where(TabPost2Tag.post_id == uid) q_u4.execute() q_u5 = TabUsage.delete().where(TabUsage.post_id == uid) q_u5.execute() reply_arr = [] for reply in TabUser2Reply.select().where( TabUser2Reply.reply_id == uid): reply_arr.append(reply.reply_id.uid) q_u6 = TabUser2Reply.delete().where(TabUser2Reply.reply_id == uid) q_u6.execute() for replyid in reply_arr: TabReply.delete().where(TabReply.uid == replyid).execute() q_u7 = TabEvaluation.delete().where(TabEvaluation.post_id == uid) q_u7.execute() q_u8 = TabRating.delete().where(TabRating.post_id == uid) q_u8.execute() return MHelper.delete(TabPost, uid)
def delete(uid): ''' Delete by uid ''' del_count = TabPostHist.delete().where(TabPostHist.uid == uid) try: del_count.execute() return False except: return True
def delete(uid): ''' Delete by uid ''' del_count = TabPostHist.delete().where(TabPostHist.uid == uid) try: del_count.execute() return False except Exception as err: print(repr(err)) return True