def updateTimelineData(_article): timelineData = operatorDB.getTimelineData() startDate = time.strftime('%Y,%m,%d',time.localtime(_article._add_time)) headline = _article._title text = '%s --- %sdetailpost/%s' % (_article._category,setting.BASE_URL,_article._id) _data = '%s,{"startDate":"%s","headline":"%s","text":"%s","asset":{"media":"","credit":"","caption":""}}' % (timelineData.timeline_data,startDate,headline,text) operatorDB.saveTimelineData(_data,timelineData.id)
def addTimelineData(): _list = operatorDB.getArticleAllForTimeline() _data = '' for _article in _list: startDate = time.strftime('%Y,%m,%d',time.localtime(_article._add_time)) headline = _article._title text = '%s --- %sdetailpost/%s' % (_article._category,setting.BASE_URL,_article._id) _data = '%s,{"startDate":"%s","headline":"%s","text":"%s","asset":{"media":"","credit":"","caption":""}}' % (_data,startDate,headline,text) operatorDB.saveTimelineData(_data[1:])