diff --git a/django_forms_as_jsonschema/layout.py b/django_forms_as_jsonschema/layout.py index 7f3e2cf24e361d83b3c81f03d283afdf36feb359..ecfdc9e2497598138a403c13f3f5ad11327041d0 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):