# Adding a checklist to a page A checklist is a panel in the corner of a page that lists what a visitor can do there: take a tour, open a page, do something in the app. It shows how many items are done, and a visitor can close the panel and open it again from a small launcher. You declare the checklist in Python, next to the view or the context processor that puts it on the page, and Driver.js shows it. ## Before you start Include the package's stylesheet and scripts in your base template, and Driver.js's checklist script beside them. [Installation](installation.md#include-the-packages-files-in-your-base-template) shows the lines. A page with a checklist then needs two things: a view or a context processor puts the checklist in the template context under `checklist`, and the page's template outputs it with `{{ checklist }}`. ## Declare a checklist Three classes describe a checklist, and each mirrors an object of Driver.js: - `Checklist` is the checklist: a name, its items, and the options that apply to all of them. - `ChecklistItem` is one item: an id, a title and a description. - `Offset` is how far the checklist sits from the corner of the window. ```python from page_tours import Checklist, ChecklistItem, Tour, TourStep WELCOME_TOUR = Tour( name="shop.welcome", autoplay=False, steps=[ TourStep(title="Welcome", description="A quick look around."), TourStep(title="Your basket", description="Items wait here.", element="#basket"), ], ) ONBOARDING = Checklist( name="shop.onboarding", title="Get started", items=[ ChecklistItem(id="welcome", title="Take the welcome tour", tour=WELCOME_TOUR), ChecklistItem(id="orders", title="Open your orders", href="/orders/"), ChecklistItem(id="first-order", title="Place your first order"), ChecklistItem( id="guide", title="Read the guide", href="https://example.com/guide", allowManualComplete=True, ), ], ) ``` Put the checklist in the context of the pages that carry it. A context processor puts it on every page, so a base template can hold `{{ checklist }}` once, at the end of ``: ```python def onboarding(request): return {"checklist": ONBOARDING} ``` Register the processor in the `context_processors` of your `TEMPLATES` setting, and place `{{ checklist }}` in the base template: ```django ... {{ checklist }} ``` `{{ checklist }}` outputs a `