def handle(self, *args, **options): if len(args) == 0: return screen_name = args[0] api = get_api() print "Crowl statuses by @%s." % screen_name for p in tweepy.Cursor(api.user_timeline, screen_name=screen_name).items(): status = Status.create_from_status(p) print status
def handle(self, *args, **options): print u"%d" % Status.objects.filter(in_reply_to_status__isnull=True).exclude( in_reply_to_status_id_str="" ).exclude(in_reply_to_status_id_str__startswith="_").count() # return for s in ( Status.objects.filter(in_reply_to_status__isnull=True) .exclude(in_reply_to_status_id_str="") .exclude(in_reply_to_status_id_str__startswith="_") ): status = Status.create_from_id(s.in_reply_to_status_id_str) if status: s.in_reply_to_status = status else: s.in_reply_to_status_id_str = u"_%s" % s.in_reply_to_status_id_str s.save() print s.in_reply_to_status_id_str, status