def get_copy(self, a): copy = Article() copy.title = a.title copy.date = a.date copy.price = a.price copy.user_id = a.user_id copy.nickname = a.nickname copy.keywords = a.keywords copy.source = a.source copy.content = a.content copy.posted = False return copy
def post_article_to_pt(post, category=None, board_id=None): from pt_poster import Article, Article_Poster article = Article() poster = Article_Poster(board_id=board_id if board_id else post.board.id) article.title = post.subject article.category = category if category else "Amazon" article.user_id = 'priceandtalk' article.nickname = 'PriceAndTalk' # article.user_id = post.user.username # article.nickname = post.user.get_profile().nickname if post.user.get_profile() and post.user.get_profile().nickname else post.user.username article.content = post.text poster.add_article(article) poster.write()