Example #1
0
def weekly(year, month, week):
    w = WeeklyMemento(year, month, week)

    return render_template(
        'weekly.html',
        weekly_memento=w,
        year=w.year,
        month=w.month,
        week=w.week,
        start_date=w.start_date,
        end_date=w.end_date,
        events=w.events,
        next_week=w.next_week,
        prev_week=w.prev_week,
    )
Example #2
0
def home():

    people_rank_limit = 18
    now = datetime.now()
    #since = now - timedelta(days=20)

    # Process trendy people
    trendy_people = []
    for entity in PublishAPI.get(
            '/entities/toprank?sinceDate=%s&rankLimit=%d' %
        ((now - timedelta(days=60)).strftime('%Y-%m-%d'), people_rank_limit)):
        trendy_people.append(People(**entity))

    # Process watchable events
    watchable_events = []
    for event_data in PublishAPI.get(
            '/events/toprank?fromDate=%s&toDate=%s&rankLimit=%d' %
        ((now - timedelta(days=20)).strftime('%Y-%m-%d'),
         now.strftime('%Y-%m-%d'), 30)):
        event = Event(**event_data)
        if event.repr_image():
            watchable_events.append(event)

    watchable_events = watchable_events[0:9]

    # Proceess 3years ago
    ago_3year_date = datetime(now.year - 3, now.month, now.day)
    tmp = PublishAPI.get('/events/toprank?fromDate=%s&toDate=%s' %
                         (ago_3year_date.strftime('%Y-%m-%d'),
                          ago_3year_date.strftime('%Y-%m-%d')))
    if len(tmp):
        event_3years_ago = Event(**tmp[0])
    else:
        event_3years_ago = None

    return render_template('home.html',
                           trendy_people=trendy_people,
                           watchable_events=watchable_events,
                           event_3years_ago_date=ago_3year_date,
                           event_3years_ago=event_3years_ago,
                           weekly_mementos=[
                               WeeklyMemento(date=now - timedelta(days=7)),
                               WeeklyMemento(date=now - timedelta(days=14)),
                               WeeklyMemento(date=now - timedelta(days=21)),
                           ])
Example #3
0
	def index(self) :
		trend_graph = get_trend_data(self.model.nickname)

		# Process trends
		sorted_trend = sorted(trend_graph, key=lambda d: d['value'], reverse=True)
		top_trend_graph = sorted_trend[0:4] # 전체 그래프중 가장 높은 4개 날짜

		top_trends = {}
		used_events = {}

		events = sorted(self.model.events, key=lambda e: e.issue_data.issue_score)

		for event in events :
			for index, tt in enumerate(top_trend_graph) :
				# Similar date
				if -15 <= (tt['period'] - event.date).days <= 15 :
					if index not in top_trends or top_trends[index]['event'].issue_data.issue_score < event.issue_data.issue_score : 
						# Update
						if event.id in used_events :
							continue

						if index in top_trends :
							used_events[ top_trends[index]['event'].id ] = False

						top_trends[index] = {
							'event': event,
							'graph_data': tt,
						}
						
						used_events[event.id] = True


		return render_template('people_magazine/summary.html',
			page='summary',
			person = self.model,
			trend_graph = trend_graph,
			top_trends = top_trends,
		)
Example #4
0
def search():
    return render_template('search.html')
Example #5
0
def privacy():
    return render_template('intro/privacy.html')
Example #6
0
def terms():
    return render_template('intro/terms.html')
Example #7
0
def about():
    return render_template('intro/about.html')
Example #8
0
def callback():
    return render_template('intro/callback.html')
Example #9
0
	def quotations(self) :
		return render_template('people_magazine/quotations.html',
			page='quotations',
			person = self.model,
		)
Example #10
0
	def images(self) :
		return render_template('people_magazine/images.html',
			page='images',
			person = self.model,
		)
Example #11
0
	def inmac(self) :
		return render_template('people_magazine/inmac.html',
			page='inmac',
			person = self.model,
		)
Example #12
0
	def timeline(self) :
		return render_template('people_magazine/timeline.html',
			page='timeline',
			person = self.model,
			timelines = self.model.get_timelines(),
		)