File: context_processors.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-- 452 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from feincms.module.page.models import Page


def add_page_if_missing(request):
    """
    If this attribute exists, then a page object has been registered already
    by some other part of the code. We let it decide which page object it
    wants to pass into the template
    """

    try:
        return {
            'feincms_page': Page.objects.for_request(request, best_match=True),
            }
    except Page.DoesNotExist:
        return {}