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.1.tar.gz (6.9 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.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: htmldict-0.1.1.tar.gz
  • Upload date:
  • Size: 6.9 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.1.tar.gz
Algorithm Hash digest
SHA256 877fa9a0a6255c90c0e85cda3169948ec83a04bc80b90789d5def789dfd45bd5
MD5 e9225e7b9cffc098862c6614b3ca225a
BLAKE2b-256 843dc14714bf7bfe7c59b42959ecbdbba7bbbda59704f095d841f6fccea32fad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: htmldict-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f24b53b687d50cadc3e87bff41941b8000acc55ad7aca4ff869f89da1b8059dc
MD5 1b6b280aab4e17d098c4903a02c49d5e
BLAKE2b-256 4819724f6945ae946e6c4b99c902616cf3cdf0e6ac202065376b095def9decc2

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