fastlifeweb 0.4.0__tar.gz → 0.4.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.
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/PKG-INFO +1 -1
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/pyproject.toml +1 -1
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/Form.jinja +1 -1
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/Select.jinja +2 -1
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/abstract.py +16 -3
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/jinjax.py +12 -2
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/model.py +3 -1
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/LICENSE +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/README.md +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/configurator/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/configurator/base.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/configurator/configurator.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/configurator/registry.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/configurator/settings.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/py.typed +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/request/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/request/form_data.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/security/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/security/csrf.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/security/policy.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/session/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/session/middleware.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/session/serializer.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/shared_utils/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/shared_utils/infer.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/shared_utils/resolver.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/A.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/Button.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/Checkbox.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/CsrfToken.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/H1.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/H2.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/H3.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/H4.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/H5.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/H6.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/Hidden.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/Input.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/Label.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/Option.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/P.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/Radio.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/pydantic_form/Boolean.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/pydantic_form/Dropdown.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/pydantic_form/Hidden.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/pydantic_form/Hint.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/pydantic_form/Model.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/pydantic_form/Sequence.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/pydantic_form/Text.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/pydantic_form/Union.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templates/pydantic_form/Widget.jinja +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/binding.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/base.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/boolean.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/dropdown.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/factory.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/hidden.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/sequence.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/text.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/union.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/testing/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/testing/testclient.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/views/__init__.py +0 -0
- {fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/views/pydantic_form.py +0 -0
@@ -4,7 +4,7 @@ action=None,
|
|
4
4
|
hx_post=None,
|
5
5
|
class_="space-y-4 md:space-y-6"
|
6
6
|
#}
|
7
|
-
<form class="{{attrs.class or class_}}" {% if hx_post is not none %}hx-post="{{hx_post}}" {% endif %}{% if action is not
|
7
|
+
<form class="{{attrs.class or class_}}" {% if hx_post is not none %}hx-post="{% if hx_post is not true %}{{hx_post}}{% endif%}" {% endif %}{% if action is not
|
8
8
|
none %}action="{{action}}" {% endif %}{% if method %}method="{{method}}" {% endif %}>
|
9
9
|
<CsrfToken />
|
10
10
|
{{ content }}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
{# def
|
2
2
|
name,
|
3
3
|
id,
|
4
|
+
multiple=False,
|
4
5
|
class_="""
|
5
6
|
bg-neutral-50
|
6
7
|
block
|
@@ -22,6 +23,6 @@ dark:text-white
|
|
22
23
|
"""
|
23
24
|
#}
|
24
25
|
|
25
|
-
<select name="{{name}}" id="{{id}}" class="{{attrs.class or class_}}">
|
26
|
+
<select name="{{name}}" id="{{id}}" class="{{attrs.class or class_}}" {% if multiple %}multiple{% endif %}>
|
26
27
|
{{- content -}}
|
27
28
|
</select>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import abc
|
2
|
-
from typing import Any, Mapping, Type
|
2
|
+
from typing import Any, Mapping, Optional, Type
|
3
3
|
|
4
4
|
from fastapi import Request
|
5
5
|
from markupsafe import Markup
|
@@ -11,8 +11,21 @@ class AbstractTemplateRenderer(abc.ABC):
|
|
11
11
|
"""Used to buid pydantic form"""
|
12
12
|
|
13
13
|
@abc.abstractmethod
|
14
|
-
def render_template(
|
15
|
-
|
14
|
+
def render_template(
|
15
|
+
self,
|
16
|
+
template: str,
|
17
|
+
*,
|
18
|
+
globals: Optional[Mapping[str, Any]] = None,
|
19
|
+
**params: Any,
|
20
|
+
) -> str:
|
21
|
+
"""
|
22
|
+
Render the given template with the given params.
|
23
|
+
|
24
|
+
While rendering templates, the globals parameter is keps by the instantiated
|
25
|
+
renderer and sent to every rendering made by the request.
|
26
|
+
This is used by the pydantic form method that will render other templates
|
27
|
+
for the request.
|
28
|
+
"""
|
16
29
|
|
17
30
|
@abc.abstractmethod
|
18
31
|
def pydantic_form(
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import TYPE_CHECKING, Any, Mapping, Optional, Sequence, Type
|
1
|
+
from typing import TYPE_CHECKING, Any, Mapping, MutableMapping, Optional, Sequence, Type
|
2
2
|
|
3
3
|
from fastapi import Request
|
4
4
|
from jinjax.catalog import Catalog
|
@@ -41,6 +41,7 @@ class JinjaxRenderer(AbstractTemplateRenderer):
|
|
41
41
|
self.request = request
|
42
42
|
self.csrf_token_name = csrf_token_name
|
43
43
|
self.form_data_model_prefix = form_data_model_prefix
|
44
|
+
self.globals: MutableMapping[str, Any] = {}
|
44
45
|
|
45
46
|
def build_globals(self) -> Mapping[str, Any]:
|
46
47
|
return {
|
@@ -50,9 +51,18 @@ class JinjaxRenderer(AbstractTemplateRenderer):
|
|
50
51
|
"value": self.request.scope.get(self.csrf_token_name, ""),
|
51
52
|
},
|
52
53
|
"pydantic_form": self.pydantic_form,
|
54
|
+
**self.globals,
|
53
55
|
}
|
54
56
|
|
55
|
-
def render_template(
|
57
|
+
def render_template(
|
58
|
+
self,
|
59
|
+
template: str,
|
60
|
+
*,
|
61
|
+
globals: Optional[Mapping[str, Any]] = None,
|
62
|
+
**params: Any,
|
63
|
+
) -> str:
|
64
|
+
if globals:
|
65
|
+
self.globals.update(globals)
|
56
66
|
return self.catalog.render( # type: ignore
|
57
67
|
template, __globals=self.build_globals(), **params
|
58
68
|
)
|
@@ -31,4 +31,6 @@ class ModelWidget(Widget[Sequence[Widget[Any]]]):
|
|
31
31
|
"widget": self,
|
32
32
|
"children_widget": children_widget,
|
33
33
|
}
|
34
|
-
return Markup(
|
34
|
+
return Markup(
|
35
|
+
renderer.render_template(self.get_template(), globals=None, **kwargs)
|
36
|
+
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/dropdown.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{fastlifeweb-0.4.0 → fastlifeweb-0.4.1}/src/fastlife/templating/renderer/widgets/sequence.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|