Skip to content
Snippets Groups Projects
Commit 54780766 authored by Julian's avatar Julian
Browse files

Reformat and Fixme

parent c7f5e630
No related tags found
1 merge request!3Draft: Resolve "Create Model for instances of a form"
...@@ -15,6 +15,7 @@ from django.utils.text import slugify ...@@ -15,6 +15,7 @@ from django.utils.text import slugify
class LayoutNode(ABC): class LayoutNode(ABC):
"""Abstract node in a form layout.""" """Abstract node in a form layout."""
def __init__(self, *elements): def __init__(self, *elements):
self.elements = elements self.elements = elements
...@@ -63,6 +64,7 @@ class Row(LayoutNode): ...@@ -63,6 +64,7 @@ class Row(LayoutNode):
def __init__(self, *elements): def __init__(self, *elements):
super().__init__(*elements) super().__init__(*elements)
self.row_name = f"row-{id(self)}" self.row_name = f"row-{id(self)}"
def build_schema(self, schema, form_fields): def build_schema(self, schema, form_fields):
"""Render this row as a JSON schema fragment.""" """Render this row as a JSON schema fragment."""
row_name = f"row-{id(self)}" row_name = f"row-{id(self)}"
...@@ -89,8 +91,10 @@ class Row(LayoutNode): ...@@ -89,8 +91,10 @@ class Row(LayoutNode):
class Fieldset(LayoutNode): class Fieldset(LayoutNode):
"""Visual set of fields in a form.""" """Visual set of fields in a form."""
def __init__(self, name: Union[tuple[str, str], str], *elements): def __init__(self, name: Union[tuple[str, str], str], *elements):
super().__init__(*elements) super().__init__(*elements)
# FIXME: name can be of __proxy__ type which can't be serialized
codename = str(slugify(name)) codename = str(slugify(name))
if isinstance(name, tuple): if isinstance(name, tuple):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment