本文整理汇总了Python中models.Post.posted_by方法的典型用法代码示例。如果您正苦于以下问题:Python Post.posted_by方法的具体用法?Python Post.posted_by怎么用?Python Post.posted_by使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Post
的用法示例。
在下文中一共展示了Post.posted_by方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tweet_data
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import posted_by [as 别名]
def tweet_data(tweet):
if "RT @" not in tweet['text']:
try:
print( '@%s tweeted: %s\nFavorites: %d Retweets: %d' %\
( tweet['user']['screen_name'], tweet['text'],tweet['favorite_count'],\
tweet['retweet_count'] ))
post = Post()
post.title = tweet['text']
print post.title
post.posted_by = tweet['user']['screen_name']
print post.posted_by
post.date_time = tweet["created_at"].replace(" +0000","")
print post.date_time
post.retweets = tweet['retweet_count']
print post.retweets
post.favorites=tweet['favorite_count']
print post.favorites
post.ups=None
print post.ups
post.from_twitter = True
print post.from_twitter
post.post_link = "http://www.twitter.com/"+str(tweet['user']['screen_name'])+"/status/"+str(tweet['id'])
print post.post_link
post.link=regex_tweet_link(tweet)
print post.link
post.save()
return post
except:
print "saving failed!"
import sys
print sys.exc_info()
示例2: reply_to_thread
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import posted_by [as 别名]
def reply_to_thread(request):
thread_name = request.POST['thread_name']
newpost = Post();
newpost.message = request.POST['message']
newpost.posted_by = request.user
newpost.topic = Thread.objects.filter(name=decode_name(thread_name))[0]
newpost.save()
args = {}
return HttpResponseRedirect(request.POST['current_url'])
示例3: reddit_data
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import posted_by [as 别名]
def reddit_data(x):
post = Post()
post.title = x.title
post.link = x.url
post.posted_by = x.fullname
post.date_time = datetime.datetime.fromtimestamp\
(int(x.created_utc)).strftime('%c')
post.ups=x.ups
post.retweets=None
post.favorites=None
post.from_twitter=False
post.post_link = "http://www.reddit.com/"+str(x.id)
post.save()
return post