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.11.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.11-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: htmldict-0.1.11.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.11.tar.gz
Algorithm Hash digest
SHA256 06046e1250241ea0c2895da5014dd1730f07cdcae19508545270f2ae0aedc2ec
MD5 bff16e1321f4651718be9189050b26ca
BLAKE2b-256 b6a9b37c9a0d3847a9c729052f6d591e5a4cfcd8124e68b7b9fb5103f26bb78b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: htmldict-0.1.11-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.11-py3-none-any.whl
Algorithm Hash digest
SHA256 f95a691f095287f5a9c83d614ea1e72dfde37bcc07335fc028b13f119315fa41
MD5 be48d9c741465eacd51eb35afc385b68
BLAKE2b-256 2c64feb485a541eb11dabc3186a51247675a038f8b0c08b02330e1798c3993b7

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