Calendar

Base class: Part

A calendar component that renders a month-grid calendar.

Note

This component is experimental. The API may change in future versions.

Example:

calendar = Calendar(
    auto__model=Album,
    event__attr='published_date',
    event__display_name=lambda event, **_: format_html(
        '<img src="/_static/album_art/{}/{}.jpg" width="30" height="30" title="{}">',
        event.artist,
         event.name,
         event.name
    ),
    event__tag=None,
    year=1983,
    month=8,
)
▼ Hide result
Toggle structure

Refinable members

actions

Type: dict[str, Action]

Cookbook:

How do I customize the calendar navigation and actions?

after     (evaluated)

Type: int | str

See after

assets

Type: Namespace

See assets

attrs     (evaluated)

Type: Attrs

auto

Type: CalendarAutoConfig

See auto

day

Type: CalendarCellConfig

Cookbook:

How do I style the calendar’s cells?

day_number

Type: CalendarCellConfig

Cookbook:

How do I style the calendar’s cells?

endpoints

Type: Namespace

event

Type: CalendarCellConfig

Cookbook:

How do I make a calendar from a model?

extra

Type: dict[str, Any]

See extra

extra_evaluated

Type: dict[str, Any]

See extra

extra_params

h_tag     (evaluated)

Type: Fragment | str

See title

include     (evaluated)

Type: bool

See include

iommi_style

Type: str | Style | None

model     (evaluated)

Type: type[Model]

Cookbook:

How do I make a calendar from a model?

month     (evaluated)

Type: int

Cookbook:

How do I make a calendar from a model?

other_month

Type: CalendarCellConfig

Cookbook:

How do I style the calendar’s cells?

rows     (evaluated)

Cookbook:

How do I make a calendar from a model?

tag     (evaluated)

Type: str

Default: table

See tag

template     (evaluated)

Type: str | Template

Default: iommi/calendar/calendar.html

See template

title     (evaluated)

Type: str | None

See title

today

Type: CalendarCellConfig

Cookbook:

How do I style the calendar’s cells?

weekday

Type: CalendarCellConfig

Cookbook:

How do I style the calendar’s cells?

weekend

Type: CalendarCellConfig

Cookbook:

How do I style the calendar’s cells?

year     (evaluated)

Type: int

Cookbook:

How do I make a calendar from a model?

Methods

as_view

days_for_month

Generate CalendarDay instances for each day in the calendar grid.

get_first_month_with_data

Return (year, month) of the earliest month that has data, or None.

get_first_with_data_url

get_last_month_with_data

Return (year, month) of the latest month that has data, or None.

get_last_with_data_url

get_month_name

get_next_month

get_next_month_with_data

Return (year, month) of the closest later month that has data, or None.

get_next_url

get_next_with_data_url

get_prev_month

get_prev_month_with_data

Return (year, month) of the closest earlier month that has data, or None.

get_prev_url

get_prev_with_data_url

get_today_url

get_weekday_names

on_bind

on_refine_done

own_evaluate_parameters

weeks_for_month

Generate weeks (lists of 7 CalendarDay instances) for the calendar grid.