La version 5 de Planète Casio. Regroupe le forum, les programmes, les tutoriel, les sprites et tous les autres outils développés par nos soins.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
925 B

from app import app, db
from app.forms.login import LoginForm
from app.forms.search import SearchForm
from app.models.forum import Forum
from app.models.topic import Topic
@app.context_processor
def menu_processor():
""" All items used to render main menu. Includes search form """
login_form = LoginForm(prefix="menu_")
search_form = SearchForm()
main_forum = Forum.query.filter_by(parent=None).first()
# Constructing last active topics
raw = db.session.execute( """SELECT topic.id FROM topic
INNER JOIN comment ON topic.thread_id = comment.thread_id
INNER JOIN post ON post.id = comment.id
GROUP BY topic.id
ORDER BY MAX(post.date_created) DESC
LIMIT 10;""")
last_active_topics = [Topic.query.get(id) for id in raw]
return dict(login_form=login_form, search_form=search_form,
main_forum=main_forum, last_active_topics=last_active_topics)