diff --git a/docs/requirements.txt b/docs/requirements.txt index d33044a..9f76d1f 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,7 +2,7 @@ email_validator==2.0.0.post2 pydantic==1.10.8 simpleeval==0.9.13 Sphinx==7.0.1 -Click==8.1.3 +Click==8.1.5 sphinx-autodoc-typehints==1.23.4 sphinxcontrib.spelling==5.4.0 sphinxcontrib.apidoc==0.3.0 diff --git a/questions/form.py b/questions/form.py index e48e805..4f8ef6c 100644 --- a/questions/form.py +++ b/questions/form.py @@ -256,7 +256,13 @@ def _add_elements(self, survey, form, top_level=False, container_name="questions self._add_elements(page, element.form) survey.pages.append(page) elif isinstance(element, (FormPage, FormPanel)): - container = getattr(survey, container_name) + container = getattr(survey, container_name, None) + if container is None: + pages = survey.pages + if len(pages) > 0: + container = getattr(pages[0], container_name) + if container is None: + raise "Error in form definition: container not found." if element.dynamic: panel = PanelDynamicBlock(name=name, **element.params) new_container_name = "template_elements" diff --git a/requirements.txt b/requirements.txt index fdfc4da..3194682 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ email_validator==2.0.0.post2 Jinja2==3.1.2 -pydantic==1.10.8 +pydantic==1.10.11 requests==2.31.0 simpleeval==0.9.13 -typing-extensions==4.5.0;python_version<"3.8" +typing-extensions==4.8.0;python_version<"3.8" diff --git a/requirements_dev.txt b/requirements_dev.txt index 3ec068e..939e5d8 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -4,10 +4,10 @@ wheel==0.40.0 watchdog==3.0.0 flake8==6.0.0 tox==4.11.3 -coverage==7.2.5 +coverage==7.3.1 Sphinx==7.0.1 twine==4.0.2 -Click==8.1.3 +Click==8.1.5 pytest==7.3.1 black==23.3.0 sphinx-autodoc-napoleon-typehints==2.1.6 diff --git a/setup.py b/setup.py index 476464e..a713883 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ "Click>=7.0", "email_validator", "Jinja2", - "pydantic", + "pydantic==1.10.11", "requests", "simpleeval", ]