Welcome | Get started | Dive into Lino | Contribute | Topics | Reference | More
pages
:¶
The lino_xl.lib.pages
plugin adds the notion of content pages used to produce the pages of websites or books.
Table of contents:
This page is a tested document and the following instructions are used for initialization:
>>> import lino
>>> lino.startup('lino_book.projects.cms1.settings')
>>> from lino.api.doctest import *
>>> from django.db.models import Q
Content pages¶
- content page¶
The basic building unit of a website or book, consisting of a title and a body.
>>> rt.show('pages.Pages', filter=Q(parent=None))
=========== ============ ====
Reference Title ID
----------- ------------ ----
index Home 1
index Startseite 25
index Départ 49
=========== ============ ====
>>> home = pages.Page.objects.get(pk=1)
>>> rt.show('pages.TranslationsByPage', master_instance=home)
(de) *Startseite*, (fr) *Départ*
>>> rt.show('pages.TranslationsByPage', master_instance=home, nosummary=True)
=========== ============ ========== ====
Reference Title Language ID
----------- ------------ ---------- ----
index Startseite de 25
index Départ fr 49
=========== ============ ========== ====
When I am on the English home page, the link to translation DE will redirect me to page #25:
>>> test_client.get("/p/1?ul=de")
<HttpResponseRedirect status_code=302, "text/html; charset=utf-8", url="/p/25?ul=de">
The same happens when I am on the French home page:
>>> test_client.get("/p/49?ul=de")
<HttpResponseRedirect status_code=302, "text/html; charset=utf-8", url="/p/25?ul=de">
The previous_page fields have been updated:
>>> rt.show(pages.Pages, column_names="id title previous_page",
... display_mode="grid", filter=Q(language="en"))
==== ===================== =====================
ID Titel Vorige Seite
---- --------------------- ---------------------
1 Home
2 Services Home
3 Washing Services
4 Drying Washing
5 Air drying Drying
6 Machine drying Air drying
7 Drying foos Machine drying
8 Drying bars Drying foos
9 Drying bazes Drying bars
10 Ironing Drying bazes
11 Prices Ironing
12 Photos Prices
13 Default formatting Photos
14 Thumbnail Default formatting
15 Thumbnail left Thumbnail
16 Tiny thumbnail Thumbnail left
17 Tiny thumbnail left Tiny thumbnail
18 Wide Tiny thumbnail left
19 Gallery Wide
20 About us Gallery
21 Team About us
22 History Team
23 Contact History
24 Terms & conditions Contact
73 Blog Terms & conditions
==== ===================== =====================
- class lino_xl.lib.pages.Page¶
The Django model that represents a content page.