File: shortcuts.py

package info (click to toggle)
python-django-feincms 1.6.2-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,716 kB
  • sloc: python: 6,585; makefile: 85; sh: 18
file content (16 lines) | stat: -rw-r--r-- 525 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from django.shortcuts import render_to_response
from django.template import RequestContext

from feincms.module.page.models import Page


def render_to_response_best_match(request, template_name, dictionary=None):
    """
    ``render_to_response`` wrapper using best match for the current page.
    """

    dictionary = dictionary or {}
    dictionary['feincms_page'] = Page.objects.best_match_for_request(request)

    return render_to_response(template_name, dictionary,
        context_instance=RequestContext(request))