tina4-python 3.13.147__tar.gz → 3.13.149__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tina4_python-3.13.147 → tina4_python-3.13.149}/PKG-INFO +1 -1
- {tina4_python-3.13.147 → tina4_python-3.13.149}/pyproject.toml +1 -1
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/__init__.py +1 -1
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/cli/__init__.py +93 -65
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/server.py +21 -2
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/crud/__init__.py +75 -31
- tina4_python-3.13.149/tina4_python/crud/page.py +344 -0
- tina4_python-3.13.149/tina4_python/crud/page_render.py +257 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/dev_admin/__init__.py +61 -3
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/messenger/__init__.py +47 -2
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/migration/runner.py +142 -7
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/session/__init__.py +11 -1
- tina4_python-3.13.149/tina4_python/templates/crud/form.twig +26 -0
- tina4_python-3.13.149/tina4_python/templates/crud/modals.twig +31 -0
- tina4_python-3.13.149/tina4_python/templates/crud/page.twig +401 -0
- tina4_python-3.13.149/tina4_python/templates/crud/table.twig +69 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/.gitignore +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/COMMERCIAL-LICENSE.md +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/LICENSE +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/NOTICE +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/README.md +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/.tina4-metrics.json +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/CLAUDE.md +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/HtmlElement.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/Testing.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/_import_helper.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/ai/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/ai/client.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/api/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/auth/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/cache/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/container/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/context/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/context/chunker.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/cache.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/constants.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/csp.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/events.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/middleware.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/port_takeover.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/rate_limiter.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/request.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/response.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/core/router.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/adapter.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/async_api.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/connection.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/database_url.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/firebird.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/mongodb.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/mssql.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/mysql.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/odbc.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/pool.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/postgres.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/sql_translator.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/database/sqlite.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/debug/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/debug/error_overlay.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/dev_admin/metrics.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/dev_admin/plan.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/dev_admin/project_index.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/docs.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/docstore/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/dotenv/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/env.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/frond/FROND.md +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/frond/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/frond/compiler.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/frond/engine.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/frond/parser.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/auth/meta.json +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/auth/src/routes/api/gallery_auth.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/database/meta.json +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/database/src/routes/api/gallery_db.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/error-overlay/meta.json +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/error-overlay/src/routes/api/gallery_crash.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/orm/meta.json +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/orm/src/orm/Product.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/orm/src/routes/api/gallery_products.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/queue/meta.json +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/queue/src/routes/api/gallery_queue.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/rest-api/meta.json +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/rest-api/src/routes/api/gallery_hello.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/templates/meta.json +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/templates/src/routes/gallery_page.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/gallery/templates/src/templates/gallery_page.twig +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/graph/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/graph/adapter.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/graph/adapters/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/graph/adapters/arango.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/graph/adapters/bolt.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/graph/adapters/ultipa.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/graph/graph_url.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/graphql/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/i18n/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/mcp/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/mcp/protocol.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/mcp/tools.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/migration/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/mqtt/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/mqtt/message.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/orm/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/orm/async_api.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/orm/collection.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/orm/fields.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/orm/model.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/orm/point.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/THIRD-PARTY-NOTICES.md +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/__feedback/widget.js +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/bundled-component-provenance.json +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/css/tina4.css +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/css/tina4.min.css +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/favicon.ico +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/images/logo.svg +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/images/tina4-logo-icon.webp +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/js/frond.js +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/js/frond.min.js +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/js/tina4-dev-admin.min.js +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/js/tina4.min.js +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/js/tina4js.min.js +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/licenses/swagger-ui-3.10.0-original-notice.txt +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/licenses/swagger-ui-5.17.14-NOTICE.txt +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/licenses/swagger-ui-Apache-2.0.txt +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/licenses/tina4-css-MIT.txt +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/licenses/tina4-dev-admin-components.json +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/licenses/tina4-dev-admin-third-party.txt +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/licenses/tina4-js-MIT.txt +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/swagger/index.html +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/public/swagger/oauth2-redirect.html +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/push/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/push/_base.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/push/_cryptography.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/push/_libcrypto.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/query_builder/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue/amqp_url.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue/job.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue/kafka_backend.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue/lite_backend.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue/mongo_backend.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue/rabbitmq_backend.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue/topic_dead_letter.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue_backends/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue_backends/kafka_backend.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue_backends/mongo_backend.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/queue_backends/rabbitmq_backend.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/realtime/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/realtime/models/Attachment.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/realtime/models/Channel.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/realtime/models/ChannelMember.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/realtime/models/Message.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/realtime/models/Workspace.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/realtime/models/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/realtime/storage.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/seeder/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/service/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/session_handlers/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/session_handlers/memcached_handler.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/session_handlers/mongodb_handler.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/session_handlers/redis_handler.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/session_handlers/valkey_handler.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/sso.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/ssrf.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/swagger/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/components/crud.twig +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/docker/distroless/Dockerfile +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/docker/poetry/Dockerfile +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/docker/python/Dockerfile +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/docker/uv/Dockerfile +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/errors/302.twig +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/errors/401.twig +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/errors/403.twig +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/errors/404.twig +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/errors/500.twig +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/errors/502.twig +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/errors/503.twig +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/errors/base.twig +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/frontend/README.md +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/templates/readme.md +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/test/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/test_client/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/af/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/af/LC_MESSAGES/messages.po +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/en/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/en/LC_MESSAGES/messages.po +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/es/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/es/LC_MESSAGES/messages.po +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/fr/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/fr/LC_MESSAGES/messages.po +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/ja/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/ja/LC_MESSAGES/messages.po +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/zh/LC_MESSAGES/messages.mo +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/translations/zh/LC_MESSAGES/messages.po +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/validator/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/websocket/__init__.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/websocket/backplane.py +0 -0
- {tina4_python-3.13.147 → tina4_python-3.13.149}/tina4_python/wsdl/__init__.py +0 -0
|
@@ -1964,84 +1964,112 @@ async def delete_{singular}(request, response):
|
|
|
1964
1964
|
|
|
1965
1965
|
|
|
1966
1966
|
def _gen_crud(name: str, flags: dict):
|
|
1967
|
-
"""
|
|
1967
|
+
"""ADR-0094: scaffold an AutoCrud-backed admin PAGE rendered by Crud.to_crud.
|
|
1968
1968
|
|
|
1969
1969
|
tina4python generate crud Product --fields "name:string,price:float"
|
|
1970
|
+
|
|
1971
|
+
The route file is named by the model's TABLE, registers the AutoCrud REST
|
|
1972
|
+
backend (secure-by-default; --public opens writes), and renders to_crud — no
|
|
1973
|
+
hand-written list/detail/write routes. The overridable crud/*.twig templates
|
|
1974
|
+
are copied into the app (unless --no-templates) so the developer owns an
|
|
1975
|
+
editable copy straight away.
|
|
1970
1976
|
"""
|
|
1971
|
-
|
|
1977
|
+
# The table name (singular, e.g. "product"; reserved words pluralised, e.g.
|
|
1978
|
+
# "orders") is the canonical path: the model declares table_name "<table>",
|
|
1979
|
+
# AutoCrud serves /api/<table>, and the page route + gate test key off it.
|
|
1972
1980
|
table = _resolve_table(name, flags)
|
|
1973
|
-
|
|
1974
|
-
# never `table + "s"`. When the table was pluralised to escape a SQL reserved
|
|
1975
|
-
# word (Order -> table `orders`), `table + "s"` double-pluralised the route,
|
|
1976
|
-
# file and template to `orderss`. Deriving from the singular base keeps one
|
|
1977
|
-
# consistent rule: Order -> orders, Product -> products.
|
|
1978
|
-
route_name = _pluralize_table(_to_snake(name))
|
|
1981
|
+
is_public = bool(flags.get("public"))
|
|
1979
1982
|
|
|
1980
1983
|
print(f"\n Generating CRUD for {name}...\n")
|
|
1981
1984
|
|
|
1982
|
-
# 1. Model + migration (emit_test=False — crud emits its own broader
|
|
1983
|
-
# at step
|
|
1985
|
+
# 1. Model + migration (emit_test=False — crud emits its own broader gate
|
|
1986
|
+
# test at step 4, so the sub-generators stay quiet to avoid double-emit).
|
|
1984
1987
|
_gen_model(name, flags, emit_test=False)
|
|
1985
1988
|
|
|
1986
|
-
# 2.
|
|
1987
|
-
#
|
|
1988
|
-
|
|
1989
|
-
route_flags = {"model": name, "public": is_public}
|
|
1990
|
-
_gen_route(route_name, route_flags, emit_test=False)
|
|
1991
|
-
|
|
1992
|
-
# 3. Template
|
|
1993
|
-
template_dir = Path("src/templates/pages")
|
|
1994
|
-
template_dir.mkdir(parents=True, exist_ok=True)
|
|
1995
|
-
template_path = template_dir / f"{route_name}.twig"
|
|
1996
|
-
if not template_path.exists():
|
|
1997
|
-
# Build column headers from fields
|
|
1998
|
-
cols = [f for f, _ in fields]
|
|
1999
|
-
th = "\n ".join(f"<th>{c.replace('_', ' ').title()}</th>" for c in cols)
|
|
2000
|
-
td = "\n ".join(f"<td>{{{{ item.{c} }}}}</td>" for c in cols)
|
|
1989
|
+
# 2. Admin page route: registers AutoCrud (secure-by-default; --public opens
|
|
1990
|
+
# writes) and renders the to_crud admin UI at /admin/<table>.
|
|
1991
|
+
_gen_crud_admin_route(name, table, is_public)
|
|
2001
1992
|
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
'<div class="container mt-4">\n'
|
|
2007
|
-
f' <h1>{name}s</h1>\n'
|
|
2008
|
-
' {# tina4:edit restrict fields exposed to the API here #}\n'
|
|
2009
|
-
' <table class="table">\n'
|
|
2010
|
-
' <thead>\n'
|
|
2011
|
-
' <tr>\n'
|
|
2012
|
-
' <th>ID</th>\n'
|
|
2013
|
-
f' {th}\n'
|
|
2014
|
-
' <th>Actions</th>\n'
|
|
2015
|
-
' </tr>\n'
|
|
2016
|
-
' </thead>\n'
|
|
2017
|
-
' <tbody>\n'
|
|
2018
|
-
' {% for item in items %}\n'
|
|
2019
|
-
' <tr>\n'
|
|
2020
|
-
' <td>{{ item.id }}</td>\n'
|
|
2021
|
-
f' {td}\n'
|
|
2022
|
-
' <td><a href="/api/' + route_name + '/{{ item.id }}">View</a></td>\n'
|
|
2023
|
-
' </tr>\n'
|
|
2024
|
-
' {% endfor %}\n'
|
|
2025
|
-
' </tbody>\n'
|
|
2026
|
-
' </table>\n'
|
|
2027
|
-
'</div>\n'
|
|
2028
|
-
'{% endblock %}\n',
|
|
2029
|
-
encoding="utf-8",
|
|
2030
|
-
)
|
|
2031
|
-
print(f" ✓ Created {template_path}")
|
|
2032
|
-
|
|
2033
|
-
# 4. Form
|
|
2034
|
-
_gen_form(name, flags)
|
|
1993
|
+
# 3. Copy the overridable crud/*.twig templates into the app (unless
|
|
1994
|
+
# --no-templates) so the developer can edit them in place.
|
|
1995
|
+
if "no-templates" not in flags:
|
|
1996
|
+
_copy_crud_templates()
|
|
2035
1997
|
|
|
2036
|
-
#
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
# 6. Test — secure-by-default gate test (behavioural, real TestClient).
|
|
2040
|
-
_gen_test(route_name, {"model": name, "secure_writes": True, "public": is_public})
|
|
1998
|
+
# 4. Test — secure-by-default gate test (behavioural, real TestClient),
|
|
1999
|
+
# keyed off the table so it imports the page route + hits /api/<table>.
|
|
2000
|
+
_gen_test(table, {"model": name, "secure_writes": True, "public": is_public})
|
|
2041
2001
|
|
|
2042
2002
|
print(f"\n CRUD generation complete for {name}.")
|
|
2043
2003
|
print(f" Run: tina4python migrate")
|
|
2044
|
-
print(f" Visit: /swagger
|
|
2004
|
+
print(f" Visit: /admin/{table} for the admin UI, or /swagger for the API docs")
|
|
2005
|
+
|
|
2006
|
+
|
|
2007
|
+
def _gen_crud_admin_route(model: str, table: str, is_public: bool):
|
|
2008
|
+
"""Write the admin page route src/routes/<table>.py. It wires the AutoCrud
|
|
2009
|
+
REST backend for the model and renders the to_crud admin page — ADR-0094:
|
|
2010
|
+
to_crud owns no routes of its own, so the backend is AutoCrud and only the
|
|
2011
|
+
GET page lives here. Secure by default; ``is_public`` opens the writes."""
|
|
2012
|
+
target = Path("src/routes")
|
|
2013
|
+
target.mkdir(parents=True, exist_ok=True)
|
|
2014
|
+
path = target / f"{table}.py"
|
|
2015
|
+
if path.exists():
|
|
2016
|
+
print(f" ✗ File already exists: {path}")
|
|
2017
|
+
return
|
|
2018
|
+
|
|
2019
|
+
if is_public:
|
|
2020
|
+
router_import = "from tina4_python.core.router import get\n"
|
|
2021
|
+
decorator = f'@get("/admin/{table}")'
|
|
2022
|
+
posture_doc = "--public: the admin page and the writes are OPEN (no token)."
|
|
2023
|
+
page_note = ""
|
|
2024
|
+
else:
|
|
2025
|
+
router_import = "from tina4_python.core.router import get, secured\n"
|
|
2026
|
+
decorator = f'@secured()\n@get("/admin/{table}")'
|
|
2027
|
+
posture_doc = ("Secure by default: the admin page AND the writes require a valid Bearer "
|
|
2028
|
+
"token (pass --public to open them).")
|
|
2029
|
+
page_note = (
|
|
2030
|
+
f"\n# NOTE: the admin page is secured (@secured). A browser needs a valid token/session\n"
|
|
2031
|
+
f"# to open it; wire your login (Auth / Session) or run `generate crud {model} --public`\n"
|
|
2032
|
+
f"# for an open page. The AutoCrud READ API (GET /api/{table}, GET /api/{table}/{{id}})\n"
|
|
2033
|
+
f"# stays public by AutoCrud's default."
|
|
2034
|
+
)
|
|
2035
|
+
|
|
2036
|
+
content = (
|
|
2037
|
+
router_import
|
|
2038
|
+
+ "from tina4_python.crud import AutoCrud, Crud\n"
|
|
2039
|
+
+ f"from src.orm.{model} import {model}\n\n\n"
|
|
2040
|
+
+ f"# {model} admin — one server-rendered CRUD page (searchable, sortable,\n"
|
|
2041
|
+
+ f"# paginated table + create/edit/delete modals). The REST backend (GET\n"
|
|
2042
|
+
+ f"# list, GET/{{id}}, POST, PUT, DELETE) is AutoCrud; this file owns only\n"
|
|
2043
|
+
+ f"# the GET admin page. {posture_doc}{page_note}\n"
|
|
2044
|
+
+ f"#\n"
|
|
2045
|
+
+ f"# Restyle the UI by editing src/templates/crud/*.twig (copied into this app).\n"
|
|
2046
|
+
+ f"AutoCrud.register({model}, public={is_public})\n\n\n"
|
|
2047
|
+
+ f"{decorator}\n"
|
|
2048
|
+
+ f"async def {table}_admin(request, response):\n"
|
|
2049
|
+
+ f' return response(Crud.to_crud(request, model={model}, title="{model} Admin"))\n'
|
|
2050
|
+
)
|
|
2051
|
+
path.write_text(content, encoding="utf-8")
|
|
2052
|
+
print(f" ✓ Created {path}")
|
|
2053
|
+
|
|
2054
|
+
|
|
2055
|
+
def _copy_crud_templates():
|
|
2056
|
+
"""Copy the framework's overridable crud/*.twig templates into the app's
|
|
2057
|
+
src/templates/crud/ so the developer can edit them in place (an app copy
|
|
2058
|
+
wins over the framework's via the app-first resolution). Existing files are
|
|
2059
|
+
left untouched."""
|
|
2060
|
+
import shutil
|
|
2061
|
+
import tina4_python
|
|
2062
|
+
|
|
2063
|
+
source_dir = Path(tina4_python.__file__).resolve().parent / "templates" / "crud"
|
|
2064
|
+
target_dir = Path("src/templates/crud")
|
|
2065
|
+
target_dir.mkdir(parents=True, exist_ok=True)
|
|
2066
|
+
for src in sorted(source_dir.glob("*.twig")):
|
|
2067
|
+
dest = target_dir / src.name
|
|
2068
|
+
if dest.exists():
|
|
2069
|
+
print(f" ✗ File already exists: {dest}")
|
|
2070
|
+
else:
|
|
2071
|
+
shutil.copyfile(src, dest)
|
|
2072
|
+
print(f" ✓ Created {dest}")
|
|
2045
2073
|
|
|
2046
2074
|
|
|
2047
2075
|
def _gen_migration(name: str, flags: dict = None, *,
|
|
@@ -3884,7 +3912,7 @@ def _commands(args=None):
|
|
|
3884
3912
|
GENERATORS = {
|
|
3885
3913
|
"model": {"handler": _gen_model, "usage": '<Name> [--fields "name:string,price:float"] [--table-name <name>]', "summary": "ORM model + matching migration"},
|
|
3886
3914
|
"route": {"handler": _gen_route, "usage": "<name> [--model Name] [--public]", "summary": "CRUD route file, secure by default (--public opens writes)"},
|
|
3887
|
-
"crud": {"handler": _gen_crud, "usage": '<Name> [--fields "..."] [--public]',
|
|
3915
|
+
"crud": {"handler": _gen_crud, "usage": '<Name> [--fields "..."] [--public] [--no-templates]', "summary": "Model + migration + AutoCrud-backed admin page (to_crud) + editable crud/ templates + gate test"},
|
|
3888
3916
|
"migration": {"handler": _gen_migration, "usage": "<description>", "summary": "Timestamped migration file (UP/DOWN)"},
|
|
3889
3917
|
"middleware": {"handler": _gen_middleware, "usage": "<Name>", "summary": "Middleware with before/after hooks"},
|
|
3890
3918
|
"test": {"handler": _gen_test, "usage": "<name> [--model Name]", "summary": "pytest test file"},
|
|
@@ -2725,6 +2725,11 @@ def _stage_dev_toolbar_inject(ctx: DispatchContext) -> None:
|
|
|
2725
2725
|
return None
|
|
2726
2726
|
if ctx.request.path.startswith("/__dev"):
|
|
2727
2727
|
return None
|
|
2728
|
+
# Do not inject the toolbar for a viewer the /__dev gate would refuse (#279):
|
|
2729
|
+
# otherwise the page carries toolbar markup whose stylesheet and script 403.
|
|
2730
|
+
from tina4_python.dev_admin import dev_toolbar_allowed
|
|
2731
|
+
if not dev_toolbar_allowed(ctx.request):
|
|
2732
|
+
return None
|
|
2728
2733
|
|
|
2729
2734
|
try:
|
|
2730
2735
|
from tina4_python.dev_admin import render_dev_toolbar
|
|
@@ -2788,6 +2793,21 @@ def _stage_request_log(ctx: DispatchContext) -> None:
|
|
|
2788
2793
|
return None
|
|
2789
2794
|
|
|
2790
2795
|
|
|
2796
|
+
def _session_needs_cookie(session) -> bool:
|
|
2797
|
+
"""Whether the response must carry this session's cookie.
|
|
2798
|
+
|
|
2799
|
+
A fresh session (only an id: minted for this request and holding no data,
|
|
2800
|
+
e.g. the replacement for a cookie the store does not know) was not stored,
|
|
2801
|
+
so a cookie for it would name nothing: the next request could not resume it
|
|
2802
|
+
and would be handed another one.
|
|
2803
|
+
"""
|
|
2804
|
+
sid = getattr(session, "session_id", None) or getattr(session, "id", None)
|
|
2805
|
+
if not sid:
|
|
2806
|
+
return False
|
|
2807
|
+
is_fresh = getattr(session, "is_fresh", None)
|
|
2808
|
+
return not (callable(is_fresh) and is_fresh())
|
|
2809
|
+
|
|
2810
|
+
|
|
2791
2811
|
def _stage_session_save(ctx: DispatchContext) -> None:
|
|
2792
2812
|
"""Persist the session and set its cookie.
|
|
2793
2813
|
|
|
@@ -2806,8 +2826,7 @@ def _stage_session_save(ctx: DispatchContext) -> None:
|
|
|
2806
2826
|
try:
|
|
2807
2827
|
if not (getattr(session, "_is_new", False) and len(session) == 0):
|
|
2808
2828
|
session.save()
|
|
2809
|
-
|
|
2810
|
-
if sid:
|
|
2829
|
+
if _session_needs_cookie(session):
|
|
2811
2830
|
# Route through the single cookie-builder so every
|
|
2812
2831
|
# TINA4_SESSION_* knob (Secure/HttpOnly/SameSite) and the
|
|
2813
2832
|
# proxy-aware Secure detection actually take effect. Do NOT
|
|
@@ -80,6 +80,59 @@ def _allow_listed_data(model_class, data, *, is_create: bool) -> dict:
|
|
|
80
80
|
return allowed
|
|
81
81
|
|
|
82
82
|
|
|
83
|
+
def _parse_list_pagination(query) -> tuple[int, int, int]:
|
|
84
|
+
"""Resolve (limit, offset, page) from the list query string.
|
|
85
|
+
|
|
86
|
+
Primary names are limit/offset; page/per_page are the PHP/Ruby/Node compat
|
|
87
|
+
spelling. Pagination is a QUERY-STRING concern, not a route param
|
|
88
|
+
(REQ-PARAM-POLLUTION, 3.13.99). PAGE-DEC-01: page < 1 clamps to 1 BEFORE the
|
|
89
|
+
offset is derived (so offset can never go negative), and per_page/limit are
|
|
90
|
+
capped at MAX_PER_PAGE BEFORE the same derivation so offset lines up with the
|
|
91
|
+
size actually used. Any bad value falls back to limit 10 / offset 0 / page 1.
|
|
92
|
+
"""
|
|
93
|
+
try:
|
|
94
|
+
limit = int(query.get("limit", query.get("per_page", 10)))
|
|
95
|
+
offset = int(query.get("offset", 0))
|
|
96
|
+
if "page" in query and "offset" not in query:
|
|
97
|
+
page = max(1, int(query.get("page", 1)))
|
|
98
|
+
per_page = min(int(query.get("per_page", limit)), MAX_PER_PAGE)
|
|
99
|
+
offset = (page - 1) * per_page
|
|
100
|
+
limit = per_page
|
|
101
|
+
else:
|
|
102
|
+
limit = min(limit, MAX_PER_PAGE)
|
|
103
|
+
page = (offset // limit) + 1 if limit else 1
|
|
104
|
+
except (ValueError, TypeError):
|
|
105
|
+
return 10, 0, 1
|
|
106
|
+
return limit, offset, page
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _resolve_list_order_by(model_class, query):
|
|
110
|
+
"""ADR-0069 safe ORDER BY from ?sort (&sort_dir=asc|desc): the sort column
|
|
111
|
+
must resolve to a DECLARED field (else it is ignored and None is returned)."""
|
|
112
|
+
sort_param = str(query.get("sort", "") or "").strip()
|
|
113
|
+
if not sort_param:
|
|
114
|
+
return None
|
|
115
|
+
sort_dir = "DESC" if str(query.get("sort_dir", "")).lower() == "desc" else "ASC"
|
|
116
|
+
sort_name = model_class._declared_field_for(sort_param)
|
|
117
|
+
if sort_name is None:
|
|
118
|
+
return None
|
|
119
|
+
return f"{model_class.get_db_column(sort_name)} {sort_dir}"
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def _build_list_search(model_class, query) -> tuple:
|
|
123
|
+
"""ADR-0094 ?search=term filter: a LIKE %term% OR'd across the model's own
|
|
124
|
+
declared string/text columns. Returns (where_clause_or_None, params)."""
|
|
125
|
+
search_term = str(query.get("search", "") or "").strip()
|
|
126
|
+
if not search_term:
|
|
127
|
+
return None, []
|
|
128
|
+
search_cols = [model_class.get_db_column(name)
|
|
129
|
+
for name, field in model_class._fields.items() if field.field_type is str]
|
|
130
|
+
if not search_cols:
|
|
131
|
+
return None, []
|
|
132
|
+
where_clause = "(" + " OR ".join(f"{col} LIKE ?" for col in search_cols) + ")"
|
|
133
|
+
return where_clause, [f"%{search_term}%" for _ in search_cols]
|
|
134
|
+
|
|
135
|
+
|
|
83
136
|
class AutoCrud:
|
|
84
137
|
"""Auto-generate REST endpoints from ORM model classes."""
|
|
85
138
|
|
|
@@ -143,37 +196,20 @@ class AutoCrud:
|
|
|
143
196
|
|
|
144
197
|
# ── GET /api/{table} — list with pagination ──────────────
|
|
145
198
|
async def list_handler(request, response, _cls=model_class):
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
# a driver error - and silently misbehave on SQLite, while the
|
|
161
|
-
# envelope reported page:0). Cap per_page BEFORE the same
|
|
162
|
-
# derivation so the offset lines up with the size actually used.
|
|
163
|
-
page = max(1, page)
|
|
164
|
-
per_page = min(per_page, MAX_PER_PAGE)
|
|
165
|
-
offset = (page - 1) * per_page
|
|
166
|
-
limit = per_page
|
|
167
|
-
else:
|
|
168
|
-
limit = min(limit, MAX_PER_PAGE) # PAGE-DEC-01: cap an oversized ?limit=
|
|
169
|
-
page = (offset // limit) + 1 if limit else 1
|
|
170
|
-
except (ValueError, TypeError):
|
|
171
|
-
limit = 10
|
|
172
|
-
offset = 0
|
|
173
|
-
page = 1
|
|
174
|
-
|
|
175
|
-
records = _cls.all(limit=limit, offset=offset)
|
|
176
|
-
total = _cls.count()
|
|
199
|
+
# Pagination, the ADR-0069-safe sort, and the ADR-0094 ?search filter
|
|
200
|
+
# are each resolved by a dedicated module helper so this handler stays
|
|
201
|
+
# a thin orchestrator. The search filter is applied BEFORE limit/offset
|
|
202
|
+
# so the envelope's total reflects the filtered set.
|
|
203
|
+
limit, offset, page = _parse_list_pagination(request.query)
|
|
204
|
+
order_by = _resolve_list_order_by(_cls, request.query)
|
|
205
|
+
where_clause, where_params = _build_list_search(_cls, request.query)
|
|
206
|
+
|
|
207
|
+
if where_clause:
|
|
208
|
+
records = _cls.where(where_clause, where_params, limit=limit, offset=offset, order_by=order_by)
|
|
209
|
+
total = _cls.count(where_clause, where_params)
|
|
210
|
+
else:
|
|
211
|
+
records = _cls.all(limit=limit, offset=offset, order_by=order_by)
|
|
212
|
+
total = _cls.count()
|
|
177
213
|
total_pages = max(1, -(-total // limit)) if limit else 1
|
|
178
214
|
record_dicts = [record.to_dict() for record in records]
|
|
179
215
|
# The canonical ADR-0043 envelope: EXACTLY seven snake_case keys, no
|
|
@@ -444,3 +480,11 @@ class AutoCrud:
|
|
|
444
480
|
def clear():
|
|
445
481
|
"""Clear all registered models (useful for testing)."""
|
|
446
482
|
AutoCrud._registered.clear()
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
# ADR-0094: the frontend-over-AutoCrud admin page generator. Imported last so
|
|
486
|
+
# that tina4_python.crud.Crud resolves AutoCrud (defined above) without a
|
|
487
|
+
# circular import.
|
|
488
|
+
from tina4_python.crud.page import Crud # noqa: E402
|
|
489
|
+
|
|
490
|
+
__all__ = ["AutoCrud", "Crud"]
|