Esempio n. 1
0
def sm_add():
    """
    Add new stream message
    """
    message = post_get('message')
    new_message = StreamMessage(message=message)
    new_message.save()
    return 'Ok'
Esempio n. 2
0
def post_index():
    all_posts = Post.get_posts().order_by(Post.date_posted.desc()).\
        limit(config.POSTS_PER_PAGE)
    for item in all_posts:
        item.post_text = shorten_text(item.post_text)

    random_banner = Banner.select().\
        where(Banner.disabled == False).order_by(fn.Rand()).first()
    quote = Quote.select().order_by(fn.Rand()).first()
    messages = StreamMessage.select()

    template = env.get_template('post/index.html')
    return template.render(posts=all_posts, banner=random_banner,
                           stream_messages=messages,
                           quote=quote,
                           link_what='pstlink')