From 54780766c47e374cbf63fc314f5eccb65136b0ae Mon Sep 17 00:00:00 2001 From: Julian Leucker <leuckerj@gmail.com> Date: Wed, 30 Nov 2022 20:12:12 +0100 Subject: [PATCH] Reformat and Fixme --- django_forms_as_jsonschema/layout.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/django_forms_as_jsonschema/layout.py b/django_forms_as_jsonschema/layout.py index 7f3e2cf..ecfdc9e 100644 --- a/django_forms_as_jsonschema/layout.py +++ b/django_forms_as_jsonschema/layout.py @@ -15,6 +15,7 @@ from django.utils.text import slugify class LayoutNode(ABC): """Abstract node in a form layout.""" + def __init__(self, *elements): self.elements = elements @@ -63,6 +64,7 @@ class Row(LayoutNode): def __init__(self, *elements): super().__init__(*elements) self.row_name = f"row-{id(self)}" + def build_schema(self, schema, form_fields): """Render this row as a JSON schema fragment.""" row_name = f"row-{id(self)}" @@ -89,8 +91,10 @@ class Row(LayoutNode): class Fieldset(LayoutNode): """Visual set of fields in a form.""" + def __init__(self, name: Union[tuple[str, str], str], *elements): super().__init__(*elements) + # FIXME: name can be of __proxy__ type which can't be serialized codename = str(slugify(name)) if isinstance(name, tuple): -- GitLab