polyadmin 0.1.0b7__tar.gz → 0.1.0b9__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.
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/CHANGELOG.md +17 -2
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/PKG-INFO +1 -1
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/browsertests/test_flows.py +14 -0
- polyadmin-0.1.0b9/browsertests/test_overflow.py +59 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/model-admin.md +29 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/python/index.md +6 -3
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/__init__.py +3 -1
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/handlers.py +13 -1
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/action.py +28 -1
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/template_context.py +37 -0
- polyadmin-0.1.0b9/polyadmin/locale/fr/LC_MESSAGES/polyadmin.mo +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/locale/fr/LC_MESSAGES/polyadmin.po +6 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/locale/polyadmin.pot +6 -0
- polyadmin-0.1.0b9/polyadmin/locale/ru/LC_MESSAGES/polyadmin.mo +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/locale/ru/LC_MESSAGES/polyadmin.po +6 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/combobox.html +1 -1
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/multi-select.html +2 -2
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/select.html +1 -1
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/table.html +10 -4
- polyadmin-0.1.0b9/polyadmin/templates/admin/resource/action_result.html +33 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templating.py +25 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/ui.py +1 -1
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/pyproject.toml +1 -1
- polyadmin-0.1.0b9/tests/contrib/fastapi/test_action_results.py +90 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/test_layout.py +1 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/uv.lock +1 -1
- polyadmin-0.1.0b7/polyadmin/locale/fr/LC_MESSAGES/polyadmin.mo +0 -0
- polyadmin-0.1.0b7/polyadmin/locale/ru/LC_MESSAGES/polyadmin.mo +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/.github/workflows/notify-docs.yml +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/.github/workflows/publish.yml +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/.gitignore +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/LICENSE +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/README.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/babel.cfg +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/browsertests/README.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/browsertests/conftest.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/browsertests/test_deletes.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/browsertests/test_i18n.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/browsertests/test_parity.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/browsertests/test_sql.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/architecture.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/audit.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/authentication.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/bulk-edit.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/components.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/concepts/architecture.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/concepts/model-admin.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/dashboard.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/deletes.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/exports.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/i18n.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/inlines.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/lists.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/permissions.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/routing.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/sqlalchemy.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/docs/templates.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/README.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/README.md +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/main.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/models.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/organization_admin.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/pages.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/project_admin.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/pyproject.toml +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/role_admin.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/session.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/sql_models.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/templates/pages/broadcast.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/tests/test_app.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/tests/test_projects.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/user_admin.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/examples/fastapi/uv.lock +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/mkdocs.yml +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/__init__.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/__init__.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/action_forms.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/audit.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/auth.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/csrf.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/dashboard.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/deletes.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/errors.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/inlines.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/locale.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/login.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/pages.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/relations.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/responses.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/router.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/fastapi/static.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/sqlalchemy/__init__.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/sqlalchemy/columns.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/sqlalchemy/filters.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/contrib/sqlalchemy/model_admin.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/__init__.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/_async.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/admin.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/audit.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/auth.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/authorization.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/csrf.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/dashboard.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/delete.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/exporter.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/field.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/filter.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/inline.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/login.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/model_admin.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/page.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/pagination.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/permissions.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/query.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/relation.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/slug.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/core/widget.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/i18n/__init__.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/i18n/context.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/i18n/negotiation.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/i18n/setup.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/i18n/translator.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/base.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/action_confirm_modal.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/bulk_edit_row.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/csrf-field.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/dashboard_filters.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/error_fragment.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/field.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/form_wrapper.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/icons.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/inline.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/inline_fragment.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/list_content.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/lookup_results.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/search.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/toasts.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/breadcrumb.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/bulk-actions.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/calendar.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/delete-preview.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/dropdown-menu.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/field.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/filter-panel.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/locale-switcher.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/pagination.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/radio-group.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/sidebar.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/slider.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/switch.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/theme-toggle.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/widget_body.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/widget_card.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/dashboard.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/error.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/login.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/resource/action_form.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/resource/delete.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/resource/delete_selected.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/resource/detail.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/resource/form.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/resource/list.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/theme.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/activity.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/chart.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/data_table.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/data_table_rows.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/donut.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/metric.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/metric_group.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/progress.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/stat.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/table.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/tabs.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/widgets/timeline.html +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/__init__.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/conftest.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/__init__.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/__init__.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_action_downloads.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_action_error.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_action_forms.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_action_placement.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_actions.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_async_model_admin.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_async_relations.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_audit.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_auth.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_bulk_edit.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_code_strings.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_components.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_csrf.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_dashboard.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_dashboard_export.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_dashboard_lazy.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_delete_preview.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_delete_selected.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_delete_selected_preview.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_errors.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_export.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_favicon.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_filters.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_htmx.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_inlines.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_list_querier.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_listopts.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_locale.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_login.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_pages.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_parity_list.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_pseudo_locale.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_record_form_error.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_relations.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_router.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_scroll_area.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_switcher.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/fastapi/test_theme.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/sqlalchemy/__init__.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/sqlalchemy/models.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/sqlalchemy/test_bulk.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/sqlalchemy/test_default_filters_http.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/sqlalchemy/test_filters.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/sqlalchemy/test_hardening.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/sqlalchemy/test_list_page.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/contrib/sqlalchemy/test_writes.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/__init__.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/mo.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_action_decorator.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_action_form.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_action_placement.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_admin.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_async.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_auth.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_authorization.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_bulk_edit.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_csrf.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_dashboard.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_dashboard_filters.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_dashboard_widgets.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_delete.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_delete_selected_i18n.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_exporter.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_field.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_filter.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_i18n.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_inline.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_login.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_model_admin.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_pagination.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_parity.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_query.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_relation.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_template_context.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/core/test_widget.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/test_catalogs.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/test_data_cell.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/test_format.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/test_layering.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/test_templating.py +0 -0
- {polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/tests/test_ui.py +0 -0
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [0.1.0b9] — 2026-11-16
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Portalled comboboxes and menus stay open when interacting with their
|
|
8
|
+
contents, and table menus are no longer clipped by the table viewport.
|
|
9
|
+
- Action buttons wrap on narrow screens instead of overflowing the page.
|
|
10
|
+
|
|
11
|
+
## [0.1.0b8] — 2026-10-29
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Actions can answer with a page shown once (`ResultPage`, `ResultItem`):
|
|
16
|
+
a title, a message and labelled values with an optional copy button,
|
|
17
|
+
start-aligned or centered (`align`), sent uncached, for what must be seen once, such as a generated password.
|
|
4
18
|
|
|
5
19
|
## [0.1.0b7] — 2026-10-08
|
|
6
20
|
|
|
@@ -93,7 +107,8 @@ First beta:
|
|
|
93
107
|
- French and Russian translations.
|
|
94
108
|
- The FastAPI adapter.
|
|
95
109
|
|
|
96
|
-
[Unreleased]: https://github.com/MagicRodri/polyadmin/compare/v0.1.
|
|
110
|
+
[Unreleased]: https://github.com/MagicRodri/polyadmin/compare/v0.1.0b9...HEAD
|
|
111
|
+
[0.1.0b9]: https://github.com/MagicRodri/polyadmin/compare/v0.1.0b7...v0.1.0b9
|
|
97
112
|
[0.1.0b7]: https://github.com/MagicRodri/polyadmin/compare/v0.1.0b6...v0.1.0b7
|
|
98
113
|
[0.1.0b6]: https://github.com/MagicRodri/polyadmin/compare/v0.1.0b5...v0.1.0b6
|
|
99
114
|
[0.1.0b5]: https://github.com/MagicRodri/polyadmin/compare/v0.1.0b4...v0.1.0b5
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: polyadmin
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0b9
|
|
4
4
|
Summary: PolyAdmin: cross-language server-rendered admin framework (Python core)
|
|
5
5
|
Project-URL: Documentation, https://magicrodri.github.io/polyadmin-docs/
|
|
6
6
|
Project-URL: Source, https://github.com/MagicRodri/polyadmin
|
|
@@ -229,6 +229,17 @@ def test_inline_relation_controls_are_not_clipped(admin_page):
|
|
|
229
229
|
assert not clipped, "the row's popover is inside a clipping ancestor"
|
|
230
230
|
|
|
231
231
|
|
|
232
|
+
def test_choosing_in_a_multi_select_keeps_it_open(admin_page):
|
|
233
|
+
admin_page.goto(f"{ADMIN_URL}/users/create")
|
|
234
|
+
admin_page.locator('[x-data="adminMultiSelect()"] button[aria-haspopup=listbox]').first.click()
|
|
235
|
+
options = admin_page.locator('[role="listbox"] [role="option"]:visible')
|
|
236
|
+
label = options.first.get_attribute("data-label")
|
|
237
|
+
options.first.click()
|
|
238
|
+
admin_page.wait_for_timeout(300)
|
|
239
|
+
expect(admin_page.locator('[role="listbox"]:visible')).to_have_count(1)
|
|
240
|
+
expect(options.filter(has_text=label)).to_have_count(0)
|
|
241
|
+
expect(options.first).to_be_visible()
|
|
242
|
+
|
|
232
243
|
def test_no_admin_page_scrolls_sideways(admin_page):
|
|
233
244
|
for path in ("", "/users", "/users/create", "/organizations/1", "/organizations/1/edit"):
|
|
234
245
|
admin_page.goto(f"{ADMIN_URL}{path}")
|
|
@@ -578,6 +589,9 @@ def test_the_organization_filter_is_searchable(admin_page):
|
|
|
578
589
|
search = admin_page.locator('[role="listbox"] input[x-ref="search"]:visible')
|
|
579
590
|
expect(search).to_be_focused()
|
|
580
591
|
search.click()
|
|
592
|
+
# Outlast the close transition: a click that wrongly counts as outside
|
|
593
|
+
# the portalled listbox would only hide it once that has run.
|
|
594
|
+
admin_page.wait_for_timeout(300)
|
|
581
595
|
expect(search).to_be_visible()
|
|
582
596
|
options = admin_page.locator('[role="listbox"] [role="option"]:visible')
|
|
583
597
|
before = options.count()
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from conftest import ADMIN_URL
|
|
2
|
+
|
|
3
|
+
TOPMOST_AT_CENTER = """el => {
|
|
4
|
+
const r = el.getBoundingClientRect();
|
|
5
|
+
const hit = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2);
|
|
6
|
+
return hit === el || el.contains(hit);
|
|
7
|
+
}"""
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _assert_reachable(page, locator):
|
|
11
|
+
viewport = page.viewport_size
|
|
12
|
+
for i in range(locator.count()):
|
|
13
|
+
item = locator.nth(i)
|
|
14
|
+
box = item.bounding_box()
|
|
15
|
+
assert box is not None
|
|
16
|
+
assert box["x"] >= 0 and box["x"] + box["width"] <= viewport["width"]
|
|
17
|
+
assert box["y"] >= 0 and box["y"] + box["height"] <= viewport["height"]
|
|
18
|
+
assert item.evaluate(TOPMOST_AT_CENTER), item.inner_text()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_row_menu_is_reachable_with_a_single_row(admin_page):
|
|
22
|
+
page = admin_page
|
|
23
|
+
page.goto(f"{ADMIN_URL}/users?search=admin@example.com")
|
|
24
|
+
rows = page.locator("#resource-list tbody tr")
|
|
25
|
+
assert rows.count() == 1
|
|
26
|
+
rows.first.get_by_role("button", name="Open menu").click()
|
|
27
|
+
items = page.locator("[role=menu]:visible [role=menuitem]")
|
|
28
|
+
items.first.wait_for()
|
|
29
|
+
assert items.count() >= 2
|
|
30
|
+
_assert_reachable(page, items)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_sort_menu_is_reachable_with_a_single_row(admin_page):
|
|
34
|
+
page = admin_page
|
|
35
|
+
page.goto(f"{ADMIN_URL}/users?search=admin@example.com")
|
|
36
|
+
page.locator("#resource-list thead button[aria-haspopup=menu]").first.click()
|
|
37
|
+
items = page.locator("[role=menu]:visible [role=menuitem]")
|
|
38
|
+
items.first.wait_for()
|
|
39
|
+
_assert_reachable(page, items)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_many_detail_actions_stay_on_screen(admin_page):
|
|
43
|
+
page = admin_page
|
|
44
|
+
for width in (1440, 800):
|
|
45
|
+
page.set_viewport_size({"width": width, "height": 900})
|
|
46
|
+
page.goto(f"{ADMIN_URL}/users")
|
|
47
|
+
page.locator("#resource-list tbody tr a").first.click()
|
|
48
|
+
page.wait_for_url("**/users/*")
|
|
49
|
+
page.evaluate(
|
|
50
|
+
"""() => {
|
|
51
|
+
const form = document.querySelector('form[action*="/actions/"]');
|
|
52
|
+
for (let i = 0; i < 8; i++) {
|
|
53
|
+
const clone = form.cloneNode(true);
|
|
54
|
+
clone.querySelector('button').textContent = 'Some long action ' + i;
|
|
55
|
+
form.parentNode.appendChild(clone);
|
|
56
|
+
}
|
|
57
|
+
}"""
|
|
58
|
+
)
|
|
59
|
+
_assert_reachable(page, page.locator('form[action*="/actions/"] button'))
|
|
@@ -513,6 +513,35 @@ async iterator of byte chunks, never both. The filename may be any Unicode:
|
|
|
513
513
|
it is sent both as an ASCII fallback and in the RFC 5987 `filename*` form
|
|
514
514
|
that current browsers read.
|
|
515
515
|
|
|
516
|
+
### Answering with a page
|
|
517
|
+
|
|
518
|
+
For what must be seen once — a generated password, a token — an action may
|
|
519
|
+
return a `ResultPage` instead. It is rendered in place of the redirect: a
|
|
520
|
+
title, an optional message and labelled values, `copy=True` adding a button
|
|
521
|
+
that copies the value. The response is not cached, and the page's only
|
|
522
|
+
control is **Back**, to where the action was started, so nothing on it runs
|
|
523
|
+
the action again:
|
|
524
|
+
|
|
525
|
+
```python
|
|
526
|
+
from polyadmin import ResultItem, ResultPage
|
|
527
|
+
|
|
528
|
+
class UserAdmin(ModelAdmin):
|
|
529
|
+
@action(label="Reset password", confirm="Reset this user's password?", where="detail")
|
|
530
|
+
def reset_password(self, objects: Sequence[User], principal: Principal | None) -> ResultPage:
|
|
531
|
+
user = objects[0]
|
|
532
|
+
password = user.reset_password()
|
|
533
|
+
return ResultPage(
|
|
534
|
+
title="Password reset",
|
|
535
|
+
message="Shown once: copy it now.",
|
|
536
|
+
items=[ResultItem("Login", user.email), ResultItem("Password", password, copy=True)],
|
|
537
|
+
)
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
The title, message and labels translate from your catalog like a flash
|
|
541
|
+
message; values are shown as given. The page sits where the other action
|
|
542
|
+
pages do; `align="center"` centers it. The template is
|
|
543
|
+
`admin/resource/action_result.html`.
|
|
544
|
+
|
|
516
545
|
### Migrating from `Action(...)`
|
|
517
546
|
|
|
518
547
|
Earlier versions declared actions as a list of `Action` objects wrapping
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
The Python implementation provides the core admin experience for Python
|
|
4
4
|
applications. The current web adapter mounts PolyAdmin into FastAPI.
|
|
5
5
|
|
|
6
|
-
## Install from
|
|
6
|
+
## Install from PyPI
|
|
7
7
|
|
|
8
|
-
PolyAdmin is
|
|
9
|
-
|
|
8
|
+
PolyAdmin is published on PyPI. Install the FastAPI adapter with:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install "polyadmin[fastapi]"
|
|
12
|
+
```
|
|
10
13
|
|
|
11
14
|
## First steps
|
|
12
15
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from polyadmin.core.action import ActionFormError, Download, action
|
|
1
|
+
from polyadmin.core.action import ActionFormError, Download, ResultItem, ResultPage, action
|
|
2
2
|
from polyadmin.core.admin import Admin
|
|
3
3
|
from polyadmin.core.delete import (
|
|
4
4
|
DELETE_PREVIEW_SAMPLE,
|
|
@@ -45,6 +45,8 @@ __all__ = [
|
|
|
45
45
|
"JSONField",
|
|
46
46
|
"ModelAdmin",
|
|
47
47
|
"PasswordField",
|
|
48
|
+
"ResultItem",
|
|
49
|
+
"ResultPage",
|
|
48
50
|
"StringField",
|
|
49
51
|
"TextField",
|
|
50
52
|
"URLField",
|
|
@@ -13,7 +13,7 @@ from fastapi import Request
|
|
|
13
13
|
from fastapi.responses import HTMLResponse, Response, StreamingResponse
|
|
14
14
|
|
|
15
15
|
from polyadmin.core._async import maybe_await
|
|
16
|
-
from polyadmin.core.action import BULK_EDIT_NAME, DELETE_SELECTED_NAME, ActionError, ActionFormError, Download
|
|
16
|
+
from polyadmin.core.action import BULK_EDIT_NAME, DELETE_SELECTED_NAME, ActionError, ActionFormError, Download, ResultPage
|
|
17
17
|
from polyadmin.core.admin import Admin
|
|
18
18
|
from polyadmin.core.audit import AUDIT_CREATE, AUDIT_DELETE, AUDIT_UPDATE
|
|
19
19
|
from polyadmin.core.authorization import resource_permission
|
|
@@ -660,6 +660,18 @@ def build_action_handler(admin: Admin, model_admin: ModelAdmin, renderer: Render
|
|
|
660
660
|
record_audit(admin, principal, model_admin, audit_name, obj)
|
|
661
661
|
if isinstance(result, Download):
|
|
662
662
|
return download_response(result)
|
|
663
|
+
if isinstance(result, ResultPage):
|
|
664
|
+
html = renderer.render_action_result(
|
|
665
|
+
admin,
|
|
666
|
+
model_admin,
|
|
667
|
+
action,
|
|
668
|
+
result,
|
|
669
|
+
return_to=redirect_to,
|
|
670
|
+
base_path=base_path,
|
|
671
|
+
principal=principal,
|
|
672
|
+
csrf_token=request.state.csrf_token,
|
|
673
|
+
)
|
|
674
|
+
return HTMLResponse(html, headers={"Cache-Control": "no-store"})
|
|
663
675
|
message = result
|
|
664
676
|
if message:
|
|
665
677
|
# A host's static message translates from its catalog; one it
|
|
@@ -50,6 +50,31 @@ class Download:
|
|
|
50
50
|
raise ValueError("Download needs exactly one of `content` or `stream`.")
|
|
51
51
|
|
|
52
52
|
|
|
53
|
+
@dataclass(frozen=True)
|
|
54
|
+
class ResultItem:
|
|
55
|
+
"""One labelled value on a ResultPage; `copy` offers a button copying it."""
|
|
56
|
+
|
|
57
|
+
label: str
|
|
58
|
+
value: str
|
|
59
|
+
copy: bool = False
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@dataclass(frozen=True)
|
|
63
|
+
class ResultPage:
|
|
64
|
+
"""A page an action answers with instead of a flash message, for what
|
|
65
|
+
must be shown once: the response is not cached and the page offers no
|
|
66
|
+
way to run the action again."""
|
|
67
|
+
|
|
68
|
+
title: str
|
|
69
|
+
message: str = ""
|
|
70
|
+
items: Sequence[ResultItem] = ()
|
|
71
|
+
align: Literal["start", "center"] = "start"
|
|
72
|
+
|
|
73
|
+
def __post_init__(self) -> None:
|
|
74
|
+
if self.align not in ("start", "center"):
|
|
75
|
+
raise ValueError(f"ResultPage align must be 'start' or 'center', not {self.align!r}.")
|
|
76
|
+
|
|
77
|
+
|
|
53
78
|
class ActionError(RuntimeError):
|
|
54
79
|
"""Raised by an action to end it with an error or warning message instead
|
|
55
80
|
of the success flash. A RuntimeError, so callers of the built-in bulk
|
|
@@ -79,7 +104,9 @@ class ActionFormError(Exception):
|
|
|
79
104
|
# The bound method a ModelAdmin's action resolves to: (objects, principal),
|
|
80
105
|
# plus the validated `data` for a form action. It may be a coroutine
|
|
81
106
|
# function; the adapter awaits it when it is one.
|
|
82
|
-
ActionHandler = Callable[
|
|
107
|
+
ActionHandler = Callable[
|
|
108
|
+
..., Awaitable[str | None | Download | ResultPage] | str | None | Download | ResultPage
|
|
109
|
+
]
|
|
83
110
|
|
|
84
111
|
F = TypeVar("F", bound=Callable[..., Any])
|
|
85
112
|
|
|
@@ -839,6 +839,43 @@ def action_form_context(
|
|
|
839
839
|
}
|
|
840
840
|
|
|
841
841
|
|
|
842
|
+
def action_result_context(
|
|
843
|
+
admin: Admin,
|
|
844
|
+
model_admin: ModelAdmin,
|
|
845
|
+
action: Any,
|
|
846
|
+
page: Any,
|
|
847
|
+
*,
|
|
848
|
+
return_to: str,
|
|
849
|
+
base_path: str = "/admin",
|
|
850
|
+
principal: Any = None,
|
|
851
|
+
csrf_token: str = "",
|
|
852
|
+
) -> dict[str, Any]:
|
|
853
|
+
"""The page a ResultPage action answers with. Host strings translate
|
|
854
|
+
from the host's catalog, like an action's flash message."""
|
|
855
|
+
slug = model_admin.get_slug()
|
|
856
|
+
heading = gettext(page.title)
|
|
857
|
+
breadcrumbs = [
|
|
858
|
+
*category_breadcrumb(model_admin.category),
|
|
859
|
+
{"label": gettext(model_admin.get_verbose_name()), "url": f"{base_path}/{slug}"},
|
|
860
|
+
{"label": gettext(action.label), "url": None, "active": True},
|
|
861
|
+
]
|
|
862
|
+
return {
|
|
863
|
+
**base_context(
|
|
864
|
+
admin,
|
|
865
|
+
principal=principal,
|
|
866
|
+
csrf_token=csrf_token,
|
|
867
|
+
model_admin=model_admin,
|
|
868
|
+
base_path=base_path,
|
|
869
|
+
breadcrumbs=breadcrumbs,
|
|
870
|
+
),
|
|
871
|
+
"heading": heading,
|
|
872
|
+
"message": gettext(page.message) if page.message else "",
|
|
873
|
+
"items": [{"label": gettext(item.label), "value": item.value, "copyable": item.copy} for item in page.items],
|
|
874
|
+
"return_to": return_to,
|
|
875
|
+
"centered": page.align == "center",
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
|
|
842
879
|
def delete_preview_view(
|
|
843
880
|
preview: ResolvedDeletePreview | None, base_path: str
|
|
844
881
|
) -> dict[str, Any]:
|
|
Binary file
|
|
@@ -134,6 +134,12 @@ msgstr "Fermer les filtres"
|
|
|
134
134
|
msgid "Confirm"
|
|
135
135
|
msgstr "Confirmer"
|
|
136
136
|
|
|
137
|
+
msgid "Copied"
|
|
138
|
+
msgstr "Copié"
|
|
139
|
+
|
|
140
|
+
msgid "Copy"
|
|
141
|
+
msgstr "Copier"
|
|
142
|
+
|
|
137
143
|
msgid "Couldn't load this section."
|
|
138
144
|
msgstr "Impossible de charger cette section."
|
|
139
145
|
|
|
Binary file
|
|
@@ -139,6 +139,12 @@ msgstr "Закрыть фильтры"
|
|
|
139
139
|
msgid "Confirm"
|
|
140
140
|
msgstr "Подтвердить"
|
|
141
141
|
|
|
142
|
+
msgid "Copied"
|
|
143
|
+
msgstr "Скопировано"
|
|
144
|
+
|
|
145
|
+
msgid "Copy"
|
|
146
|
+
msgstr "Скопировать"
|
|
147
|
+
|
|
142
148
|
msgid "Couldn't load this section."
|
|
143
149
|
msgstr "Не удалось загрузить раздел."
|
|
144
150
|
|
{polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/combobox.html
RENAMED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
selectActive() { if (this.activeEl) this.activeEl.click(); }
|
|
41
41
|
}"
|
|
42
42
|
x-init="query = $refs.textInput.value;"
|
|
43
|
-
@click.outside="open = false">
|
|
43
|
+
@click.outside="$refs.results.contains($event.target) || (open = false)">
|
|
44
44
|
<input x-ref="hiddenInput" type="hidden" name="{{ name }}"
|
|
45
45
|
value="{{ selected_pk if selected_pk is not none else '' }}">
|
|
46
46
|
<div x-ref="trigger" class="{{ ui('combobox', 'trigger') }}">
|
{polyadmin-0.1.0b7 → polyadmin-0.1.0b9}/polyadmin/templates/admin/components/ui/multi-select.html
RENAMED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
open with no selection. #}
|
|
37
37
|
<div class="{{ ui('combobox') }}" x-data="adminMultiSelect()" x-init="$nextTick(() => hydrate())"
|
|
38
38
|
x-id="['ms-option', 'ms-listbox']"
|
|
39
|
-
@keydown.escape="closeToTrigger()" @click.outside="close()">
|
|
39
|
+
@keydown.escape="closeToTrigger()" @click.outside="$refs.popover.contains($event.target) || close()">
|
|
40
40
|
{# Real inputs rather than one comma-joined value: the server already
|
|
41
41
|
speaks "repeated field name", and joining would mean inventing a
|
|
42
42
|
separator some primary key eventually contains. #}
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
{# Portalled to <body>, as Radix does -- see the relation combobox in
|
|
75
75
|
ui/field.html for why. #}
|
|
76
76
|
<template x-teleport="body">
|
|
77
|
-
<div x-show="open" x-cloak
|
|
77
|
+
<div x-ref="popover" x-show="open" x-cloak
|
|
78
78
|
x-anchor.bottom-start.offset.4="$refs.trigger"
|
|
79
79
|
{# A cell trigger is too narrow to size the popover by, so there it
|
|
80
80
|
only sets a floor and the options decide the width. On a form the
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
rather than walking every choice. #}
|
|
34
34
|
<div class="{{ ui('combobox') }}" data-label="{{ selected_label.value or placeholder }}"
|
|
35
35
|
x-data="adminSelect()" x-init="hydrate()" x-id="['select-option', 'select-listbox']"
|
|
36
|
-
@keydown.escape="closeToTrigger()" @click.outside="close()">
|
|
36
|
+
@keydown.escape="closeToTrigger()" @click.outside="$refs.options.contains($event.target) || close()">
|
|
37
37
|
<input type="hidden" name="{{ name }}" x-ref="hiddenInput" value="{{ selected if selected is not none else '' }}">
|
|
38
38
|
<button type="button" x-ref="trigger" @click="toggle()"
|
|
39
39
|
:aria-expanded="open ? 'true' : 'false'" aria-haspopup="listbox"
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
<span class="inline-flex h-8 items-center">{{ _(model_admin.get_field(name).label) }}</span>
|
|
92
92
|
{% else %}
|
|
93
93
|
<div class="relative inline-flex" x-data="{ open: false }"
|
|
94
|
-
@keydown.escape="open = false" @click.outside="open = false">
|
|
94
|
+
@keydown.escape="open = false" @click.outside="$refs.panel.contains($event.target) || (open = false)">
|
|
95
95
|
<button type="button" x-ref="sort{{ loop.index }}" @click="open = !open"
|
|
96
96
|
:aria-expanded="open ? 'true' : 'false'" aria-haspopup="menu"
|
|
97
97
|
class="-ml-3 h-8 gap-1 {{ ui('button', 'ghost-muted', 'size-xs') }} data-[state=open]:bg-accent">
|
|
@@ -100,7 +100,9 @@
|
|
|
100
100
|
{%- elif sorted_by.direction == "desc" %}{{ icon("arrow-down", "size-3.5") }}
|
|
101
101
|
{%- else %}{{ icon("chevrons-up-down", "size-3.5 opacity-50") }}{% endif %}
|
|
102
102
|
</button>
|
|
103
|
-
<
|
|
103
|
+
<template x-teleport="body">
|
|
104
|
+
<div x-ref="panel" x-show="open" x-cloak role="menu"
|
|
105
|
+
x-init="window.htmx && htmx.process($el)" @keydown.escape="open = false"
|
|
104
106
|
x-anchor.bottom-start.offset.6="$refs.sort{{ loop.index }}"
|
|
105
107
|
x-transition:enter="transition ease-out duration-150"
|
|
106
108
|
x-transition:enter-start="opacity-0 scale-95"
|
|
@@ -119,6 +121,7 @@
|
|
|
119
121
|
{{ icon("arrow-down", "size-4 shrink-0 text-muted-foreground") }}<span class="truncate">{{ _("Desc") }}</span>
|
|
120
122
|
</a>
|
|
121
123
|
</div>
|
|
124
|
+
</template>
|
|
122
125
|
</div>
|
|
123
126
|
{% endif %}
|
|
124
127
|
</th>
|
|
@@ -158,14 +161,16 @@
|
|
|
158
161
|
{% endfor %}
|
|
159
162
|
<td class="{{ ui('table', 'cell') }} text-right">
|
|
160
163
|
{% if permissions.can_view or permissions.can_update or permissions.can_delete %}
|
|
161
|
-
<div class="relative inline-flex" x-data="{ open: false }" @keydown.escape="open = false" @click.outside="open = false">
|
|
164
|
+
<div class="relative inline-flex" x-data="{ open: false }" @keydown.escape="open = false" @click.outside="$refs.panel.contains($event.target) || (open = false)">
|
|
162
165
|
<button type="button" x-ref="trigger" @click="open = !open"
|
|
163
166
|
:aria-expanded="open ? 'true' : 'false'" aria-haspopup="menu" aria-label="{{ _('Open menu') }}"
|
|
164
167
|
:class="open ? 'bg-accent text-accent-foreground' : ''"
|
|
165
168
|
class="{{ ui('button', 'ghost-muted', 'size-icon-sm') }}">
|
|
166
169
|
{{ icon("dots-vertical", "w-4 h-4") }}
|
|
167
170
|
</button>
|
|
168
|
-
<
|
|
171
|
+
<template x-teleport="body">
|
|
172
|
+
<div x-ref="panel" x-show="open" x-cloak role="menu"
|
|
173
|
+
x-init="window.htmx && htmx.process($el)" @keydown.escape="open = false"
|
|
169
174
|
x-anchor.bottom-end.offset.6="$refs.trigger"
|
|
170
175
|
x-transition:enter="transition ease-out duration-150"
|
|
171
176
|
x-transition:enter-start="opacity-0 scale-95"
|
|
@@ -207,6 +212,7 @@
|
|
|
207
212
|
{% endif %}
|
|
208
213
|
{% endif %}
|
|
209
214
|
</div>
|
|
215
|
+
</template>
|
|
210
216
|
</div>
|
|
211
217
|
{% endif %}
|
|
212
218
|
</td>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{% extends "admin/base.html" %}
|
|
2
|
+
{% from "admin/components/icons.html" import icon %}
|
|
3
|
+
{% block title %}{{ heading }}{% endblock %}
|
|
4
|
+
{% block content %}
|
|
5
|
+
<div id="action-result" class="{{ ui('panel', 'form') }} max-w-xl{% if centered %} mx-auto{% endif %}">
|
|
6
|
+
<p class="{{ ui('text', 'heading') }}">{{ heading }}</p>
|
|
7
|
+
{% if message %}<p class="mt-1 {{ ui('text', 'muted') }}">{{ message }}</p>{% endif %}
|
|
8
|
+
{% if items %}
|
|
9
|
+
<dl class="{{ ui('card') }} mt-4 divide-y divide-border">
|
|
10
|
+
{% for item in items %}
|
|
11
|
+
<div class="grid grid-cols-1 gap-1 px-4 py-3 sm:grid-cols-3 sm:gap-4">
|
|
12
|
+
<dt class="text-sm font-medium text-muted-foreground">{{ item.label }}</dt>
|
|
13
|
+
<dd class="flex items-center gap-2 text-sm text-foreground sm:col-span-2"
|
|
14
|
+
{% if item.copyable %}x-data="{ copied: false }"{% endif %}>
|
|
15
|
+
<span class="break-all font-mono" {% if item.copyable %}x-ref="value"{% endif %}>{{ item.value }}</span>
|
|
16
|
+
{% if item.copyable %}
|
|
17
|
+
<button type="button" class="{{ ui('button', 'outline', 'size-sm') }} shrink-0"
|
|
18
|
+
@click="navigator.clipboard.writeText($refs.value.textContent); copied = true; setTimeout(() => copied = false, 1500)">
|
|
19
|
+
{{ icon("copy", "w-3.5 h-3.5") }}
|
|
20
|
+
<span x-show="!copied">{{ _("Copy") }}</span>
|
|
21
|
+
<span x-show="copied" x-cloak>{{ _("Copied") }}</span>
|
|
22
|
+
</button>
|
|
23
|
+
{% endif %}
|
|
24
|
+
</dd>
|
|
25
|
+
</div>
|
|
26
|
+
{% endfor %}
|
|
27
|
+
</dl>
|
|
28
|
+
{% endif %}
|
|
29
|
+
<div class="mt-4 flex flex-col gap-2 sm:flex-row">
|
|
30
|
+
<a href="{{ return_to }}" id="action-result-back" class="{{ ui('button', 'outline') }}">{{ _("Back") }}</a>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
{% endblock %}
|
|
@@ -27,6 +27,7 @@ from polyadmin.core.permissions import compute_permissions
|
|
|
27
27
|
from polyadmin.core.query import DEFAULT_EMPTY_VALUE, ListRequest
|
|
28
28
|
from polyadmin.core.template_context import (
|
|
29
29
|
action_form_context,
|
|
30
|
+
action_result_context,
|
|
30
31
|
dashboard_card,
|
|
31
32
|
dashboard_context,
|
|
32
33
|
delete_context,
|
|
@@ -582,6 +583,30 @@ class Renderer:
|
|
|
582
583
|
)
|
|
583
584
|
return self.render_candidates(model_admin.get_template_candidates("action_form"), context)
|
|
584
585
|
|
|
586
|
+
def render_action_result(
|
|
587
|
+
self,
|
|
588
|
+
admin: Admin,
|
|
589
|
+
model_admin: ModelAdmin,
|
|
590
|
+
action: Any,
|
|
591
|
+
page: Any,
|
|
592
|
+
*,
|
|
593
|
+
return_to: str,
|
|
594
|
+
base_path: str = "/admin",
|
|
595
|
+
principal: Any = None,
|
|
596
|
+
csrf_token: str = "",
|
|
597
|
+
) -> str:
|
|
598
|
+
context = action_result_context(
|
|
599
|
+
admin,
|
|
600
|
+
model_admin,
|
|
601
|
+
action,
|
|
602
|
+
page,
|
|
603
|
+
return_to=return_to,
|
|
604
|
+
base_path=base_path,
|
|
605
|
+
principal=principal,
|
|
606
|
+
csrf_token=csrf_token,
|
|
607
|
+
)
|
|
608
|
+
return self.render_candidates(model_admin.get_template_candidates("action_result"), context)
|
|
609
|
+
|
|
585
610
|
|
|
586
611
|
# A summary of recent activity, not an audit browser: a logger wanting the
|
|
587
612
|
# full trail exposed can surface it where it already lives.
|
|
@@ -735,7 +735,7 @@ UI_REGISTRY: dict[str, dict[str, object]] = {
|
|
|
735
735
|
# the bar reads Delete-left / everything-else-right when a
|
|
736
736
|
# Delete is present and simply right-aligns when it isn't
|
|
737
737
|
# (create, and detail once Delete moved to the edit page).
|
|
738
|
-
"actions-primary": "flex flex-col gap-2 sm:ml-auto sm:flex-row",
|
|
738
|
+
"actions-primary": "flex min-w-0 flex-col gap-2 sm:ml-auto sm:flex-row sm:flex-wrap sm:justify-end",
|
|
739
739
|
},
|
|
740
740
|
},
|
|
741
741
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from fastapi import FastAPI
|
|
3
|
+
from fastapi.testclient import TestClient
|
|
4
|
+
|
|
5
|
+
from polyadmin import ResultItem, ResultPage
|
|
6
|
+
from polyadmin.contrib.fastapi.router import create_router
|
|
7
|
+
from polyadmin.core.action import action
|
|
8
|
+
from polyadmin.core.admin import Admin
|
|
9
|
+
from polyadmin.core.field import StringField
|
|
10
|
+
from tests.conftest import csrf
|
|
11
|
+
from tests.core.test_model_admin import InMemoryUserAdmin
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ResultUserAdmin(InMemoryUserAdmin):
|
|
15
|
+
@action(label="Issue token")
|
|
16
|
+
def issue_token(self, objects, principal):
|
|
17
|
+
return ResultPage(
|
|
18
|
+
title="Token issued",
|
|
19
|
+
message="Shown once.",
|
|
20
|
+
items=[
|
|
21
|
+
ResultItem("Email", objects[0].email),
|
|
22
|
+
ResultItem("Token", "s3cret-<token>", copy=True),
|
|
23
|
+
],
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
@action(label="Centered")
|
|
27
|
+
def centered(self, objects, principal):
|
|
28
|
+
return ResultPage(title="Centered", align="center")
|
|
29
|
+
|
|
30
|
+
@action(label="Tag", form=[StringField("tag", required=True)])
|
|
31
|
+
def tag(self, objects, principal, data):
|
|
32
|
+
return ResultPage(title="Tagged", items=[ResultItem("Tag", data["tag"])])
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def make_client():
|
|
36
|
+
users = ResultUserAdmin()
|
|
37
|
+
app = FastAPI()
|
|
38
|
+
app.include_router(create_router(Admin(model_admins=[users]), base_path="/admin"), prefix="/admin")
|
|
39
|
+
return TestClient(app), users
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def post(client, name, data):
|
|
43
|
+
return client.post(f"/admin/users/actions/{name}", data=data, follow_redirects=False, headers=csrf(client))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_result_page_shows_its_items_once():
|
|
47
|
+
client, users = make_client()
|
|
48
|
+
a = users.create({"email": "a@x.com"})
|
|
49
|
+
response = post(client, "issue_token", {"pks": [str(a.id)], "_return": f"/admin/users/{a.id}"})
|
|
50
|
+
assert response.status_code == 200
|
|
51
|
+
assert response.headers["cache-control"] == "no-store"
|
|
52
|
+
html = response.text
|
|
53
|
+
assert "Token issued" in html and "Shown once." in html
|
|
54
|
+
assert "a@x.com" in html
|
|
55
|
+
assert "s3cret-<token>" in html
|
|
56
|
+
assert 'id="action-result-back"' in html and f'href="/admin/users/{a.id}"' in html
|
|
57
|
+
assert "/actions/issue_token" not in html
|
|
58
|
+
assert "admin_messages" not in response.headers.get("set-cookie", "")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_only_copyable_items_get_a_copy_button():
|
|
62
|
+
client, users = make_client()
|
|
63
|
+
a = users.create({"email": "a@x.com"})
|
|
64
|
+
html = post(client, "issue_token", {"pks": [str(a.id)]}).text
|
|
65
|
+
assert html.count('x-ref="value"') == 1
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_form_action_can_answer_with_a_result_page():
|
|
69
|
+
client, users = make_client()
|
|
70
|
+
a = users.create({"email": "a@x.com"})
|
|
71
|
+
response = post(client, "tag", {"pks": [str(a.id)], "_confirmed": "1", "tag": "vip"})
|
|
72
|
+
assert response.status_code == 200
|
|
73
|
+
assert "Tagged" in response.text and "vip" in response.text
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def result_class(html):
|
|
77
|
+
start = html.index('id="action-result"')
|
|
78
|
+
return html[start : html.index(">", start)]
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def test_result_page_starts_aligned_unless_centered():
|
|
82
|
+
client, users = make_client()
|
|
83
|
+
a = users.create({"email": "a@x.com"})
|
|
84
|
+
assert "mx-auto" not in result_class(post(client, "issue_token", {"pks": [str(a.id)]}).text)
|
|
85
|
+
assert "mx-auto" in result_class(post(client, "centered", {"pks": [str(a.id)]}).text)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def test_result_page_refuses_an_unknown_alignment():
|
|
89
|
+
with pytest.raises(ValueError):
|
|
90
|
+
ResultPage(title="x", align="left")
|
|
@@ -24,6 +24,7 @@ SHARED_LAYOUT = {
|
|
|
24
24
|
"admin/resource/delete.html",
|
|
25
25
|
"admin/resource/delete_selected.html",
|
|
26
26
|
"admin/resource/action_form.html",
|
|
27
|
+
"admin/resource/action_result.html",
|
|
27
28
|
"admin/components/list_content.html",
|
|
28
29
|
"admin/components/search.html",
|
|
29
30
|
"admin/components/form_wrapper.html",
|