from eventmanager.eventos.models import *
def build_response(request, template, extra={}):
+ """
+ Shortcut to build a response based on a C{template} and build a standard
+ context to this template. This context contains news itens, a list of menus
+ and a list of sections to be shown on index. But don't worry, this context
+ is extensible through the C{extra} parameter.
+
+ @param template: Contains the name of a template found in django
+ C{TEMPLATE_DIRS}
+ @type template: C{str}
+
+ @param extra: Extra variables to be passed to the context being built.
+ @type extra: C{dict}
+ """
news = Noticia.objects.order_by('-data_criacao')
menus = Menu.objects.all()
index_sections = Secao.objects.filter(index=True)