This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fasthtml.common import * | |
app,rt = fast_app(debug=True) | |
db = database(":memory:") | |
clients = db.t.clients | |
if clients not in db.t: | |
clients.create(id=int,name=str,address=str,email=str,pk='id') | |
Client = clients.dataclass() | |
def create_form(): | |
return Form(id="create-form", hx_post="/", hx_target="#client-list", hx_swap="beforeend") | |
def create_row(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fasthtml.common import * | |
app, rt = fast_app(debug=True) | |
db = database(":memory:") | |
clients = db.t.clients | |
if clients not in db.t: | |
clients.create(id=int, name=str, address=str, email=str, pk='id') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import argparse | |
from fasthtml.components import html2ft | |
def main(): | |
# Set up the argument parser | |
parser = argparse.ArgumentParser(description='Process an HTML file and output a Python file.') | |
parser.add_argument('filename', help='The name of the HTML file (without extension) located in the src folder.') | |
parser.add_argument('--output-dir', default='.', help='Optional output directory for the .py file (default is root).') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Check if pyenv is installed, else exit with an error message | |
where /q pyenv >nul 2>nul | |
if %errorlevel% neq 0 ( | |
echo Error: pyenv is not installed. Please install pyenv and try again. | |
exit /b 1 | |
) | |
REM Check if pipenv is installed, else exit with an error message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if pyenv is installed, else exit with an error message | |
if ! command -v pyenv &> /dev/null; then | |
echo "Error: pyenv is not installed. Please install pyenv and try again." | |
exit 1 | |
fi | |
# Check if pipenv is installed, else exit with an error message | |
if ! command -v pipenv &> /dev/null; then |