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): try: del_count2 = TabUser2Reply.delete().where(TabUser2Reply.reply_id == uid) del_count2.execute() del_count = TabReply.delete().where(TabReply.uid == uid) del_count.execute() return True except: return False
def delete(uid): try: del_count2 = TabUser2Reply.delete().where( TabUser2Reply.reply_id == uid) del_count2.execute() del_count = TabReply.delete().where(TabReply.uid == uid) del_count.execute() rec = TabReplyid.select().where(TabReplyid.reply0 == uid) for x in rec: del_count3 = TabReply.delete().where(TabReply.uid == x.reply1) del_count3.execute() del_count4 = TabReplyid.delete().where(TabReplyid.reply0 == uid) del_count4.execute() return True except Exception as err: print(repr(err)) return False