def attachment_delete(order_id, aid): attachment = Attachment.get(aid) target_type = attachment.target_type attachment.delete() flash(u'删除成功!', 'success') if target_type == 'ClientOrder': return redirect(url_for("files.client_order_files", order_id=order_id)) elif target_type == 'Order': return redirect(url_for("files.medium_order_files", order_id=order_id)) elif target_type == 'DoubanOrder': return redirect(url_for("files.douban_order_files", order_id=order_id)) elif target_type == 'AssociatedDoubanOrder': return redirect( url_for("files.associated_douban_order_files", order_id=order_id)) elif target_type == 'FrameworkOrder': return redirect( url_for("files.framework_order_files", order_id=order_id)) elif target_type == 'searchAdFrameworkOrder': return redirect( url_for("files.searchAd_framework_order_files", order_id=order_id)) elif target_type == 'searchAdClientOrder': return redirect( url_for("files.searchAd_client_order_files", order_id=order_id)) elif target_type == 'searchAdOrder': return redirect( url_for("files.searchAd_medium_order_files", order_id=order_id)) elif target_type == 'ClientMediumOrder': return redirect( url_for("files.client_meduim_order_files", order_id=order_id))
def files_delete(f_type, type, aid, id): attachment = Attachment.get(aid) attachment.delete() flash(FILE_TYPE_CN[int(type)] + u' 删除成功', 'success') if f_type == 'medium': return redirect(url_for('searchAd_client.medium_detail', medium_id=id)) elif f_type == 'agent': return redirect(url_for('searchAd_client.agent_detail', agent_id=id))
def attachment_delete(order_id, aid): attachment = Attachment.get(aid) target_type = attachment.target_type attachment.delete() flash(u'删除成功!', 'success') if target_type == 'ClientOrder': return redirect(url_for("files.client_order_files", order_id=order_id)) elif target_type == 'Order': return redirect(url_for("files.medium_order_files", order_id=order_id)) elif target_type == 'DoubanOrder': return redirect(url_for("files.douban_order_files", order_id=order_id)) elif target_type == 'AssociatedDoubanOrder': return redirect(url_for("files.associated_douban_order_files", order_id=order_id)) elif target_type == 'FrameworkOrder': return redirect(url_for("files.framework_order_files", order_id=order_id)) elif target_type == 'searchAdFrameworkOrder': return redirect(url_for("files.searchAd_framework_order_files", order_id=order_id)) elif target_type == 'searchAdClientOrder': return redirect(url_for("files.searchAd_client_order_files", order_id=order_id)) elif target_type == 'searchAdOrder': return redirect(url_for("files.searchAd_medium_order_files", order_id=order_id)) elif target_type == 'ClientMediumOrder': return redirect(url_for("files.client_meduim_order_files", order_id=order_id))
def medium_files_delete(medium_id, aid): attachment = Attachment.get(aid) attachment.delete() flash(u'删除成功!', 'success') return redirect(url_for("searchAd_client.medium_detail", medium_id=medium_id))
def agent_files_delete(agent_id, aid): attachment = Attachment.get(aid) attachment.delete() flash(u'删除成功!', 'success') return redirect(url_for("searchAd_client.agent_detail", agent_id=agent_id))
def files_delete(mid, aid): attachment = Attachment.get(aid) type = attachment.attachment_type attachment.delete() flash(u'删除成功!', 'success') return redirect(url_for("mediums_files.info_last", mid=mid, type=type))