author | Tero Marttila <terom@paivola.fi> |
Sun, 14 Sep 2014 03:03:30 +0300 | |
changeset 69 | 4b8814ff6d6d |
parent 68 | 023b9a9d6c76 |
child 74 | d8413d2b0bee |
permissions | -rw-r--r-- |
60
bd9cea0b5b11
qmsk_www_pages: pages.Page.lookup() and .html support; logging
Tero Marttila <terom@paivola.fi>
parents:
56
diff
changeset
|
1 |
from django.http import Http404 |
54
92552b2d8e34
manage.py startapp qmsk_www_pages
Tero Marttila <terom@paivola.fi>
parents:
diff
changeset
|
2 |
from django.shortcuts import render |
92552b2d8e34
manage.py startapp qmsk_www_pages
Tero Marttila <terom@paivola.fi>
parents:
diff
changeset
|
3 |
|
60
bd9cea0b5b11
qmsk_www_pages: pages.Page.lookup() and .html support; logging
Tero Marttila <terom@paivola.fi>
parents:
56
diff
changeset
|
4 |
from qmsk_www_pages import pages |
bd9cea0b5b11
qmsk_www_pages: pages.Page.lookup() and .html support; logging
Tero Marttila <terom@paivola.fi>
parents:
56
diff
changeset
|
5 |
|
54
92552b2d8e34
manage.py startapp qmsk_www_pages
Tero Marttila <terom@paivola.fi>
parents:
diff
changeset
|
6 |
# Create your views here. |
56 | 7 |
def page (request, page): |
65
67d8600fa0a1
pages: Site, footer with modified, basic css styles, page tree types
Tero Marttila <terom@paivola.fi>
parents:
64
diff
changeset
|
8 |
page = pages.page(page) |
56 | 9 |
|
60
bd9cea0b5b11
qmsk_www_pages: pages.Page.lookup() and .html support; logging
Tero Marttila <terom@paivola.fi>
parents:
56
diff
changeset
|
10 |
if not page: |
bd9cea0b5b11
qmsk_www_pages: pages.Page.lookup() and .html support; logging
Tero Marttila <terom@paivola.fi>
parents:
56
diff
changeset
|
11 |
raise Http404 |
bd9cea0b5b11
qmsk_www_pages: pages.Page.lookup() and .html support; logging
Tero Marttila <terom@paivola.fi>
parents:
56
diff
changeset
|
12 |
|
bd9cea0b5b11
qmsk_www_pages: pages.Page.lookup() and .html support; logging
Tero Marttila <terom@paivola.fi>
parents:
56
diff
changeset
|
13 |
return render(request, 'pages/page.html', dict( |
65
67d8600fa0a1
pages: Site, footer with modified, basic css styles, page tree types
Tero Marttila <terom@paivola.fi>
parents:
64
diff
changeset
|
14 |
site_name = page.tree.site.name, |
68
023b9a9d6c76
pages: tree parents, hierarchy; tree/page titles
Tero Marttila <terom@paivola.fi>
parents:
65
diff
changeset
|
15 |
tree_list = list(page.tree.list()), |
61 | 16 |
page_name = page.name, |
68
023b9a9d6c76
pages: tree parents, hierarchy; tree/page titles
Tero Marttila <terom@paivola.fi>
parents:
65
diff
changeset
|
17 |
page_title = page.title, |
61 | 18 |
page_breadcrumb = page.breadcrumb(), |
69
4b8814ff6d6d
pages: page.hierarchy() for navigation
Tero Marttila <terom@paivola.fi>
parents:
68
diff
changeset
|
19 |
page_hierarchy = list(page.hierarchy()), |
61 | 20 |
page_html = page.render(request), |
65
67d8600fa0a1
pages: Site, footer with modified, basic css styles, page tree types
Tero Marttila <terom@paivola.fi>
parents:
64
diff
changeset
|
21 |
page_modified = page.modified(), |
60
bd9cea0b5b11
qmsk_www_pages: pages.Page.lookup() and .html support; logging
Tero Marttila <terom@paivola.fi>
parents:
56
diff
changeset
|
22 |
)) |