Data Reference
Every template receives a small set of objects from pyplanner. This page is a
complete reference of those objects, their properties and the values they
produce. Keep it open while you design - it answers “what can I put inside
{{ }}?”.
Key topics
The variables injected into every template (
base,calendar,langandparams).Year, Month, Day, WeekDay objects and their properties.
The
month.tablegrid explained visually.String representation shortcuts.
The
loopvariable insideforblocks.
Injected variables
pyplanner passes these variables to your template:
Name |
Type |
Description |
|---|---|---|
|
string |
Path prefix pointing to the template directory. Prefix every Don’t prepend |
|
Calendar |
Entry point for all calendar data. Use it to build a Year object and to access weekday names. |
|
string |
The active display language code (e.g. |
|
namespace |
Template parameters loaded from |
Calendar
The calendar object itself has two things you will use:
Expression |
Type |
Description |
|---|---|---|
|
Year |
Build a Year object for the given year number. |
|
tuple |
Seven WeekDay objects starting from the configured first day of the week.
Defaults to Monday through Sunday; changes when |
|
int |
The first day of the week as a number (0 = Monday … 6 = Sunday). |
|
string |
The active display language code (same value as the top-level |
calendar.weekdays example (default, Monday start):
Template:
%% for wd in calendar.weekdays
{{ wd.name }}
%% endfor
Output:
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
When --first-weekday sunday is used, the same loop outputs:
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Year
Returned by calendar.year().
Property |
Type |
Example |
Description |
|---|---|---|---|
|
int |
|
The year number. |
|
list |
(12 Month objects) |
All months, January through December. |
|
string |
|
Identifier string. Useful for HTML |
|
bool |
|
Whether the year is a leap year. |
|
iterator |
(365 or 366 Day objects) |
Every day in the year, in order. |
String representation: {{ year }} outputs the year number, for example
2026.
Month
Each item in year.months.
Property |
Type |
Example |
Description |
|---|---|---|---|
|
int |
|
Month number (1 = January, 12 = December). |
|
string |
|
Full month name (translated when |
|
string |
|
Abbreviated month name (translated when |
|
list |
(28-31 Day objects) |
Every day in the month, in order. |
|
list of lists |
(see below) |
Calendar grid for rendering tables. |
|
string |
|
Identifier in |
String representation: {{ month }} outputs the month name, for example
January.
Understanding month.table
month.table is a list of weeks. Each week is a list of seven slots - one per
weekday, ordered to match calendar.weekdays. A slot contains a Day object or
None if that weekday falls outside the month.
The column order depends on the configured first day of the week.
January 2026 starts on Thursday. With the default Monday start the table looks like this:
Mon Tue Wed Thu Fri Sat Sun
---- ---- ---- ---- ---- ---- ----
None None None 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 None
In your template you loop over weeks (rows) and then over days (cells). Check
for None before printing:
%% for week in month.table
<tr>
%% for day in week
%% if day is not none
<td>{{ day }}</td>
%% else
<td></td>
%% endif
%% endfor
</tr>
%% endfor
Day
Each item in month.days or in the cells of month.table.
Property |
Type |
Example |
Description |
|---|---|---|---|
|
int |
|
Day of month number. |
|
WeekDay |
(WeekDay object) |
The weekday this day falls on. |
|
string |
|
Identifier in |
|
bool |
|
Whether this is a day off (weekend or public holiday). |
|
string or None |
|
International holiday name if the day is a public holiday, otherwise
|
|
string or None |
|
Localized holiday name in the country’s language, otherwise |
|
int or None |
|
The year the public holiday was established, otherwise |
|
tuple of strings or None |
|
Holiday type labels.
|
String representation: {{ day }} outputs the day number, for example
15.
Linking between pages
Every Day, Month and Year has an id property that makes a good HTML anchor.
Set it as the id of a .page div, then link to it with #:
Template:
## Create a page with an anchor
<div class="page" id="{{ day.id }}">
...
</div>
## Link to that page from elsewhere
<a href="#{{ day.id }}">{{ day }}</a>
Output:
<div class="page" id="2026-01-15">
...
</div>
<a href="#2026-01-15">15</a>
WeekDay
Each item in calendar.weekdays or accessed through day.weekday.
Property |
Type |
Example |
Description |
|---|---|---|---|
|
int |
|
Weekday number (starting from zero). |
|
string |
|
Full weekday name (translated when |
|
string |
|
Abbreviated weekday name (translated when |
|
string |
|
Single-letter weekday label (translated when |
|
bool |
|
Default off-day flag. Saturday and Sunday are |
String representation: {{ weekday }} outputs the weekday name, for
example Monday.
Common patterns:
Expression |
Output |
|---|---|
|
|
|
|
|
|
loop variable reference
Available inside every %% for block.
Property |
Description |
|---|---|
|
Current iteration number, starting at 1. |
|
Current iteration number, starting at 0. |
|
|
|
|
|
Total number of items in the list. |
|
Iterations remaining (including current), starting at the length and counting down to 1. |
|
Like |
Quick cheat sheet
lang -> "en" (set by --lang)
params -> namespace from params.xml
.year -> 2026 (example int param)
.accent -> "#4A90D9" (example str param)
.colors.primary -> "#000" (nested namespace)
calendar
.year(2026) -> Year
.weekdays -> (Mon, Tue, ..., Sun) *rotated by --first-weekday*
.firstweekday -> 0 (0=Mon .. 6=Sun)
.lang -> "en"
Year
.value -> 2026
.months -> [January, ..., December]
.id -> "2026"
.isleap -> false
.days() -> iterator of all Day objects
Month
.value -> 1
.name -> "January"
.short_name -> "Jan"
.days -> [Day(1), Day(2), ..., Day(31)]
.table -> [[None, None, ..., Day], ...]
.id -> "2026-01"
Day
.value -> 15
.weekday -> WeekDay
.id -> "2026-01-15"
.is_off_day -> true / false
.name -> "Christmas Day" / None
.local_name -> "Weihnachten" / None
.launch_year -> 1967 / None
.holiday_types -> ("Public",) / None
WeekDay
.value -> 0
.name -> "Monday"
.short_name -> "Mon"
.letter -> "M"
.is_off_day -> false
What is next
Continue to Template Parameters to learn how to declare customizable parameters for your template.