WuttaWeb 0.11.0__tar.gz → 0.12.1__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.
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/CHANGELOG.md +30 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/PKG-INFO +2 -2
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/pyproject.toml +2 -2
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/forms/base.py +19 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/forms/schema.py +25 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/forms/widgets.py +85 -1
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/grids/base.py +669 -5
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/appinfo/configure.mako +54 -5
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/appinfo/index.mako +44 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/auth/login.mako +23 -7
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/base.mako +79 -32
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/base_meta.mako +3 -3
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/configure.mako +27 -5
- wuttaweb-0.12.1/src/wuttaweb/templates/deform/readonly/objectref.pt +9 -0
- wuttaweb-0.12.1/src/wuttaweb/templates/deform/readonly/rolerefs.pt +7 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/form.mako +4 -4
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/forms/vue_template.mako +14 -1
- wuttaweb-0.12.1/src/wuttaweb/templates/grids/table_element.mako +49 -0
- wuttaweb-0.12.1/src/wuttaweb/templates/grids/vue_template.mako +685 -0
- wuttaweb-0.12.1/src/wuttaweb/templates/home.mako +35 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/page.mako +1 -1
- wuttaweb-0.12.1/src/wuttaweb/templates/wutta-components.mako +167 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/views/common.py +5 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/views/master.py +133 -3
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/views/people.py +29 -8
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/views/roles.py +12 -1
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/views/settings.py +103 -40
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/views/users.py +4 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/forms/test_base.py +24 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/forms/test_schema.py +14 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/forms/test_widgets.py +59 -2
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/grids/test_base.py +521 -16
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/views/test_common.py +11 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/views/test_master.py +253 -204
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/views/test_people.py +44 -5
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/views/test_settings.py +21 -0
- wuttaweb-0.11.0/src/wuttaweb/templates/deform/readonly/objectref.pt +0 -1
- wuttaweb-0.11.0/src/wuttaweb/templates/grids/vue_template.mako +0 -349
- wuttaweb-0.11.0/src/wuttaweb/templates/home.mako +0 -19
- wuttaweb-0.11.0/src/wuttaweb/templates/wutta-components.mako +0 -71
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/.gitignore +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/COPYING.txt +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/README.md +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/Makefile +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/_static/.keepme +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/index.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/app.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/auth.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/db.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/forms.base.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/forms.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/forms.schema.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/forms.widgets.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/grids.base.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/grids.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/handler.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/helpers.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/index.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/menus.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/static.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/subscribers.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/util.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/views.auth.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/views.base.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/views.common.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/views.essential.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/views.master.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/views.people.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/views.roles.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/views.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/views.settings.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/api/wuttaweb/views.users.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/conf.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/glossary.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/index.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/make.bat +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/narr/index.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/narr/templates/base.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/narr/templates/index.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/narr/templates/lookup.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/docs/narr/templates/overview.rst +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/__init__.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/_version.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/app.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/auth.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/db.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/forms/__init__.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/grids/__init__.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/handler.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/helpers.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/menus.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/static/__init__.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/static/img/favicon.ico +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/static/img/logo.png +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/static/img/testing.png +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/subscribers.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/auth/change_password.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/deform/checkbox.pt +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/deform/checkbox_choice.pt +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/deform/checked_password.pt +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/deform/password.pt +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/deform/permissions.pt +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/deform/readonly/notes.pt +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/deform/readonly/permissions.pt +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/deform/select.pt +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/deform/textarea.pt +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/deform/textinput.pt +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/forbidden.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/master/configure.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/master/create.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/master/delete.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/master/edit.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/master/form.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/master/index.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/master/view.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/notfound.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/people/view_profile.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/templates/setup.mako +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/util.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/views/__init__.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/views/auth.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/views/base.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/src/wuttaweb/views/essential.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tasks.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/__init__.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/forms/__init__.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/grids/__init__.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/bb_fontawesome_svg_core.js +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/bb_free_solid_svg_icons.js +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/bb_oruga.js +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/bb_oruga_bulma.css +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/bb_oruga_bulma.js +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/bb_vue.js +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/bb_vue_fontawesome.js +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/buefy.css +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/buefy.js +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/fontawesome.js +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/vue.js +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/libcache/vue_resource.js +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/test_app.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/test_auth.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/test_handler.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/test_helpers.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/test_menus.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/test_static.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/test_subscribers.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/test_util.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/util.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/views/__init__.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/views/test___init__.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/views/test_auth.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/views/test_base.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/views/test_roles.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tests/views/test_users.py +0 -0
- {wuttaweb-0.11.0 → wuttaweb-0.12.1}/tox.ini +0 -0
|
@@ -5,6 +5,36 @@ All notable changes to wuttaweb will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## v0.12.1 (2024-08-22)
|
|
9
|
+
|
|
10
|
+
### Fix
|
|
11
|
+
|
|
12
|
+
- improve home, login page styles for large logo image
|
|
13
|
+
|
|
14
|
+
## v0.12.0 (2024-08-22)
|
|
15
|
+
|
|
16
|
+
### Feat
|
|
17
|
+
|
|
18
|
+
- add "copy link" button for sharing a grid view
|
|
19
|
+
- add initial support for proper grid filters
|
|
20
|
+
- add initial filtering logic to grid class
|
|
21
|
+
- add "searchable" column support for grids
|
|
22
|
+
- improve page linkage between role/user/person
|
|
23
|
+
- add basic autocomplete support, for Person
|
|
24
|
+
|
|
25
|
+
### Fix
|
|
26
|
+
|
|
27
|
+
- cleanup templates for home, login pages
|
|
28
|
+
- cleanup logic for appinfo/configure
|
|
29
|
+
- expose settings for app node title, type
|
|
30
|
+
- show installed python packages on appinfo page
|
|
31
|
+
- tweak login form to stop extending size of background card
|
|
32
|
+
- add setting to auto-redirect anon users to login, from home page
|
|
33
|
+
- add form padding, validators for /configure pages
|
|
34
|
+
- add padding around main form, via wrapper css
|
|
35
|
+
- show CRUD buttons in header only if relevant and user has access
|
|
36
|
+
- tweak style config for home link app title in main menu
|
|
37
|
+
|
|
8
38
|
## v0.11.0 (2024-08-20)
|
|
9
39
|
|
|
10
40
|
### Feat
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: WuttaWeb
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.1
|
|
4
4
|
Summary: Web App for Wutta Framework
|
|
5
5
|
Project-URL: Homepage, https://wuttaproject.org/
|
|
6
6
|
Project-URL: Repository, https://forgejo.wuttaproject.org/wutta/wuttaweb
|
|
@@ -35,7 +35,7 @@ Requires-Dist: pyramid-tm
|
|
|
35
35
|
Requires-Dist: pyramid>=2
|
|
36
36
|
Requires-Dist: waitress
|
|
37
37
|
Requires-Dist: webhelpers2
|
|
38
|
-
Requires-Dist: wuttjamaican[db]>=0.12.
|
|
38
|
+
Requires-Dist: wuttjamaican[db]>=0.12.1
|
|
39
39
|
Requires-Dist: zope-sqlalchemy>=1.5
|
|
40
40
|
Provides-Extra: docs
|
|
41
41
|
Requires-Dist: furo; extra == 'docs'
|
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "WuttaWeb"
|
|
9
|
-
version = "0.
|
|
9
|
+
version = "0.12.1"
|
|
10
10
|
description = "Web App for Wutta Framework"
|
|
11
11
|
readme = "README.md"
|
|
12
12
|
authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]
|
|
@@ -41,7 +41,7 @@ dependencies = [
|
|
|
41
41
|
"pyramid_tm",
|
|
42
42
|
"waitress",
|
|
43
43
|
"WebHelpers2",
|
|
44
|
-
"WuttJamaican[db]>=0.12.
|
|
44
|
+
"WuttJamaican[db]>=0.12.1",
|
|
45
45
|
"zope.sqlalchemy>=1.5",
|
|
46
46
|
]
|
|
47
47
|
|
|
@@ -25,6 +25,7 @@ Base form classes
|
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
import logging
|
|
28
|
+
from collections import OrderedDict
|
|
28
29
|
|
|
29
30
|
import colander
|
|
30
31
|
import deform
|
|
@@ -311,6 +312,9 @@ class Form:
|
|
|
311
312
|
|
|
312
313
|
self.set_fields(fields or self.get_fields())
|
|
313
314
|
|
|
315
|
+
# nb. this tracks grid JSON data for inclusion in page template
|
|
316
|
+
self.grid_vue_data = OrderedDict()
|
|
317
|
+
|
|
314
318
|
def __contains__(self, name):
|
|
315
319
|
"""
|
|
316
320
|
Custom logic for the ``in`` operator, to allow easily checking
|
|
@@ -750,6 +754,10 @@ class Form:
|
|
|
750
754
|
kwargs['appstruct'] = self.model_instance
|
|
751
755
|
|
|
752
756
|
form = deform.Form(schema, **kwargs)
|
|
757
|
+
# nb. must give a reference back to wutta form; this is
|
|
758
|
+
# for sake of field schema nodes and widgets, e.g. to
|
|
759
|
+
# access the main model instance
|
|
760
|
+
form.wutta_form = self
|
|
753
761
|
self.deform_form = form
|
|
754
762
|
|
|
755
763
|
return self.deform_form
|
|
@@ -818,6 +826,17 @@ class Form:
|
|
|
818
826
|
output = render(template, context)
|
|
819
827
|
return HTML.literal(output)
|
|
820
828
|
|
|
829
|
+
def add_grid_vue_data(self, grid):
|
|
830
|
+
""" """
|
|
831
|
+
if not grid.key:
|
|
832
|
+
raise ValueError("grid must have a key!")
|
|
833
|
+
|
|
834
|
+
if grid.key in self.grid_vue_data:
|
|
835
|
+
log.warning("grid data with key '%s' already registered, "
|
|
836
|
+
"but will be replaced", grid.key)
|
|
837
|
+
|
|
838
|
+
self.grid_vue_data[grid.key] = grid.get_vue_data()
|
|
839
|
+
|
|
821
840
|
def render_vue_field(
|
|
822
841
|
self,
|
|
823
842
|
fieldname,
|
|
@@ -246,6 +246,9 @@ class ObjectRef(colander.SchemaType):
|
|
|
246
246
|
values.insert(0, self.empty_option)
|
|
247
247
|
kwargs['values'] = values
|
|
248
248
|
|
|
249
|
+
if 'url' not in kwargs:
|
|
250
|
+
kwargs['url'] = lambda person: self.request.route_url('people.view', uuid=person.uuid)
|
|
251
|
+
|
|
249
252
|
return widgets.ObjectRefWidget(self.request, **kwargs)
|
|
250
253
|
|
|
251
254
|
|
|
@@ -321,6 +324,28 @@ class RoleRefs(WuttaSet):
|
|
|
321
324
|
return widgets.RoleRefsWidget(self.request, **kwargs)
|
|
322
325
|
|
|
323
326
|
|
|
327
|
+
class UserRefs(WuttaSet):
|
|
328
|
+
"""
|
|
329
|
+
Form schema type for the Role
|
|
330
|
+
:attr:`~wuttjamaican:wuttjamaican.db.model.auth.Role.users`
|
|
331
|
+
association proxy field.
|
|
332
|
+
|
|
333
|
+
This is a subclass of :class:`WuttaSet`. It uses a ``set`` of
|
|
334
|
+
:class:`~wuttjamaican:wuttjamaican.db.model.auth.User` ``uuid``
|
|
335
|
+
values for underlying data format.
|
|
336
|
+
"""
|
|
337
|
+
|
|
338
|
+
def widget_maker(self, **kwargs):
|
|
339
|
+
"""
|
|
340
|
+
Constructs a default widget for the field.
|
|
341
|
+
|
|
342
|
+
:returns: Instance of
|
|
343
|
+
:class:`~wuttaweb.forms.widgets.UserRefsWidget`.
|
|
344
|
+
"""
|
|
345
|
+
kwargs.setdefault('session', self.session)
|
|
346
|
+
return widgets.UserRefsWidget(self.request, **kwargs)
|
|
347
|
+
|
|
348
|
+
|
|
324
349
|
class Permissions(WuttaSet):
|
|
325
350
|
"""
|
|
326
351
|
Form schema type for the Role
|
|
@@ -44,6 +44,7 @@ from deform.widget import (Widget, TextInputWidget, TextAreaWidget,
|
|
|
44
44
|
from webhelpers2.html import HTML
|
|
45
45
|
|
|
46
46
|
from wuttaweb.db import Session
|
|
47
|
+
from wuttaweb.grids import Grid
|
|
47
48
|
|
|
48
49
|
|
|
49
50
|
class ObjectRefWidget(SelectWidget):
|
|
@@ -83,9 +84,19 @@ class ObjectRefWidget(SelectWidget):
|
|
|
83
84
|
"""
|
|
84
85
|
readonly_template = 'readonly/objectref'
|
|
85
86
|
|
|
86
|
-
def __init__(self, request, *args, **kwargs):
|
|
87
|
+
def __init__(self, request, url=None, *args, **kwargs):
|
|
87
88
|
super().__init__(*args, **kwargs)
|
|
88
89
|
self.request = request
|
|
90
|
+
self.url = url
|
|
91
|
+
|
|
92
|
+
def get_template_values(self, field, cstruct, kw):
|
|
93
|
+
""" """
|
|
94
|
+
values = super().get_template_values(field, cstruct, kw)
|
|
95
|
+
|
|
96
|
+
if 'url' not in values and self.url and field.schema.model_instance:
|
|
97
|
+
values['url'] = self.url(field.schema.model_instance)
|
|
98
|
+
|
|
99
|
+
return values
|
|
89
100
|
|
|
90
101
|
|
|
91
102
|
class NotesWidget(TextAreaWidget):
|
|
@@ -137,12 +148,17 @@ class RoleRefsWidget(WuttaCheckboxChoiceWidget):
|
|
|
137
148
|
"""
|
|
138
149
|
Widget for use with User
|
|
139
150
|
:attr:`~wuttjamaican:wuttjamaican.db.model.auth.User.roles` field.
|
|
151
|
+
This is the default widget for the
|
|
152
|
+
:class:`~wuttaweb.forms.schema.RoleRefs` type.
|
|
140
153
|
|
|
141
154
|
This is a subclass of :class:`WuttaCheckboxChoiceWidget`.
|
|
142
155
|
"""
|
|
156
|
+
readonly_template = 'readonly/rolerefs'
|
|
143
157
|
|
|
144
158
|
def serialize(self, field, cstruct, **kw):
|
|
145
159
|
""" """
|
|
160
|
+
model = self.app.model
|
|
161
|
+
|
|
146
162
|
# special logic when field is editable
|
|
147
163
|
readonly = kw.get('readonly', self.readonly)
|
|
148
164
|
if not readonly:
|
|
@@ -159,10 +175,78 @@ class RoleRefsWidget(WuttaCheckboxChoiceWidget):
|
|
|
159
175
|
if val[0] != admin.uuid]
|
|
160
176
|
kw['values'] = values
|
|
161
177
|
|
|
178
|
+
else: # readonly
|
|
179
|
+
|
|
180
|
+
# roles
|
|
181
|
+
roles = []
|
|
182
|
+
if cstruct:
|
|
183
|
+
for uuid in cstruct:
|
|
184
|
+
role = self.session.query(model.Role).get(uuid)
|
|
185
|
+
if role:
|
|
186
|
+
roles.append(role)
|
|
187
|
+
kw['roles'] = roles
|
|
188
|
+
|
|
189
|
+
# url
|
|
190
|
+
url = lambda role: self.request.route_url('roles.view', uuid=role.uuid)
|
|
191
|
+
kw['url'] = url
|
|
192
|
+
|
|
162
193
|
# default logic from here
|
|
163
194
|
return super().serialize(field, cstruct, **kw)
|
|
164
195
|
|
|
165
196
|
|
|
197
|
+
class UserRefsWidget(WuttaCheckboxChoiceWidget):
|
|
198
|
+
"""
|
|
199
|
+
Widget for use with Role
|
|
200
|
+
:attr:`~wuttjamaican:wuttjamaican.db.model.auth.Role.users` field.
|
|
201
|
+
This is the default widget for the
|
|
202
|
+
:class:`~wuttaweb.forms.schema.UserRefs` type.
|
|
203
|
+
|
|
204
|
+
This is a subclass of :class:`WuttaCheckboxChoiceWidget`; however
|
|
205
|
+
it only supports readonly mode and does not use a template.
|
|
206
|
+
Rather, it generates and renders a
|
|
207
|
+
:class:`~wuttaweb.grids.base.Grid` showing the users list.
|
|
208
|
+
"""
|
|
209
|
+
|
|
210
|
+
def serialize(self, field, cstruct, **kw):
|
|
211
|
+
""" """
|
|
212
|
+
readonly = kw.get('readonly', self.readonly)
|
|
213
|
+
if not readonly:
|
|
214
|
+
raise NotImplementedError("edit not allowed for this widget")
|
|
215
|
+
|
|
216
|
+
model = self.app.model
|
|
217
|
+
columns = ['person', 'username', 'active']
|
|
218
|
+
|
|
219
|
+
# generate data set for users
|
|
220
|
+
users = []
|
|
221
|
+
if cstruct:
|
|
222
|
+
for uuid in cstruct:
|
|
223
|
+
user = self.session.query(model.User).get(uuid)
|
|
224
|
+
if user:
|
|
225
|
+
users.append(dict([(key, getattr(user, key))
|
|
226
|
+
for key in columns + ['uuid']]))
|
|
227
|
+
|
|
228
|
+
# grid
|
|
229
|
+
grid = Grid(self.request, key='roles.view.users',
|
|
230
|
+
columns=columns, data=users)
|
|
231
|
+
|
|
232
|
+
# view action
|
|
233
|
+
if self.request.has_perm('users.view'):
|
|
234
|
+
url = lambda user, i: self.request.route_url('users.view', uuid=user['uuid'])
|
|
235
|
+
grid.add_action('view', icon='eye', url=url)
|
|
236
|
+
grid.set_link('person')
|
|
237
|
+
grid.set_link('username')
|
|
238
|
+
|
|
239
|
+
# edit action
|
|
240
|
+
if self.request.has_perm('users.edit'):
|
|
241
|
+
url = lambda user, i: self.request.route_url('users.edit', uuid=user['uuid'])
|
|
242
|
+
grid.add_action('edit', url=url)
|
|
243
|
+
|
|
244
|
+
# render as simple <b-table>
|
|
245
|
+
# nb. must indicate we are a part of this form
|
|
246
|
+
form = getattr(field.parent, 'wutta_form', None)
|
|
247
|
+
return grid.render_table_element(form)
|
|
248
|
+
|
|
249
|
+
|
|
166
250
|
class PermissionsWidget(WuttaCheckboxChoiceWidget):
|
|
167
251
|
"""
|
|
168
252
|
Widget for use with Role
|