コード例 #1
0
ファイル: site.py プロジェクト: imgugu/xichuangzhu
def index():
    works = Work.get_works_by_random(4)
    for work in works:
        work['Content'] = content_clean(work['Content'])

    work_images = Work.get_images_by_random(9)

    reviews = Review.get_reviews_by_random(4)
    for r in reviews:
        r['Time'] = time_diff(r['Time'])

    authors = Author.get_authors_by_random(5)
    for a in authors:
        quote = Quote.get_quote_by_random(a['AuthorID'])
        a['Quote'] = quote['Quote'] if quote else ""
        a['QuoteID'] = quote['QuoteID'] if quote else 0

    dynasties = Dynasty.get_dynasties()
    topics = Topic.get_topics(8)
    return render_template('site/index.html',
                           works=works,
                           work_images=work_images,
                           reviews=reviews,
                           authors=authors,
                           dynasties=dynasties,
                           topics=topics)
コード例 #2
0
def topics():
    topics = Topic.get_topics(15)
    for t in topics:
        t['Time'] = time_diff(t['Time'])

    nodes = Node.get_nodes(16)

    hot_topics = Topic.get_hot_topics(10)
    
    node_types = Node.get_types()
    for nt in node_types:
        nt['nodes'] = Node.get_nodes_by_type(nt['TypeID'])

    return render_template('topic/topics.html', topics=topics, nodes=nodes, hot_topics=hot_topics, node_types=node_types)
コード例 #3
0
ファイル: home.py プロジェクト: frank7725/xichuangzhu
def index():
	works = Work.get_works_by_random(4)
	for work in works:
		work['Content'] = content_clean(work['Content'])

	reviews = Review.get_reviews_by_random(4)
	for r in reviews:
		r['Time'] = time_diff(r['Time'])
	
	authors = Author.get_authors_by_random(5)
	for a in authors:
		quote = Quote.get_quote_by_random(a['AuthorID'])
		a['Quote'] = quote['Quote'] if quote else ""
	
	dynasties = Dynasty.get_dynasties()
	topics = Topic.get_topics(8)
	return render_template('index.html', works=works, reviews=reviews, authors=authors, dynasties=dynasties, topics=topics)