Skip to main content

html-calendar

Project description

This module has the simple purpose of building html calendar tables with links and formatting. It is totally framework agnostic.

The module provides the htmlcalendar Python function that takes an starting date and a number of months for rendering the HTML Tables containing the specified months with formated cells and HTML links on day’s numbers.

Formatting is provided by passing a callback function as the classes parameters that takes the date and returns a list of CSS classes that are applied to the date’s cell.

Linking dates to URLs is also provided by a callback function passed as the links parameter that takes the date and returns a fully qualified HTML link if required or None if not.

You can also format the days that are not in the month but appear in the table with the option no_month_class. And the classes for formatting the headers and the table using the options th_classes and table_classes.

It also supports North American calendar with the option caltype putting its value to 1.

from flask import Flask
from datetime import date
from htmlcalendar import htmlcalendar

app = Flask("party")

def links(date):
        if date.weekday() == 5:
                return "https://github.com/llou/html-calendar"

def css_class(date):
        if date.weekday() == 5:
                return ["party"]

@app.route("/")
def party_calendar():
        return htmlcalendar(date.today(), months=1, links=links, classes=css_class)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

html-calendar-0.0.3.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

html_calendar-0.0.3-py2.py3-none-any.whl (3.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file html-calendar-0.0.3.tar.gz.

File metadata

  • Download URL: html-calendar-0.0.3.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for html-calendar-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f0d788780385d87b8be70614e7ead2c516b5c0ce8a71f6a289f5041b9b330c57
MD5 8790a6af9f271fd67ccabbe61c794261
BLAKE2b-256 810d56a98a1b2cde77d4926af87e4de3365d93ccab4401680fdcf9a3f9eecd66

See more details on using hashes here.

Provenance

File details

Details for the file html_calendar-0.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for html_calendar-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 20e84969a6b6062c4358c767d83559caf8bad069d06f56fdd7b6f6db688fa0b4
MD5 b8a834fefd821895f064539a6ae24b77
BLAKE2b-256 8ddf2d8d2bf406271e7f3789c34bcb55c1d032b9618884db4eb380c162403058

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page