Skip to main content

Python dict objects with the ability to serve html

Project description

A lightweight Python class that extends dict to generate HTML templates and integrate with databases.

Usage

from htmldict import HTMLDict
from p2d2 import Database

class Person(HTMLDict):
    _title = "name"
    _subtitle = "role" 
    _redirect_uri = "https://profile/${id}"
    name: str
    role: str
    id: str

# Create instance
person = Person(name="John Doe", role="Developer", id="123")

# Generate HTML
html_card = person.card
html_detail = person.detail
html_label = person.label

# Save to database
class DB(Database):
    person: Person

db = DB("mydb")
person.commit_to_database(db)

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

htmldict-0.1.12.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

htmldict-0.1.12-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file htmldict-0.1.12.tar.gz.

File metadata

  • Download URL: htmldict-0.1.12.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.2 Windows/11

File hashes

Hashes for htmldict-0.1.12.tar.gz
Algorithm Hash digest
SHA256 0b02221073d67996d41a1890d5ff8b30e9baa64145aca00121773104adbf7912
MD5 2d69d710303e64b96ecf8f98d8094807
BLAKE2b-256 748d61a67dc092db43472c7c597ee1f3b885c38abedcba06cfff59abca50ac86

See more details on using hashes here.

File details

Details for the file htmldict-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: htmldict-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.2 Windows/11

File hashes

Hashes for htmldict-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 c56de55212ea43494d6267b3c3c929a3fcc0787e8614eba5dd0ba1075a7c870e
MD5 fd9c816f42a942d2fe60e860d017c545
BLAKE2b-256 290916363d822e70d8af6ff2a68588b9ba7d0a4146d3e4b28f32fb728455106a

See more details on using hashes here.

Supported by

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