divio / aldryn-forms

Flexible HTML forms for your django CMS projects
Other
40 stars 68 forks source link

Copying of a Fieldset or Form instances breaks the page on a Paste action #197

Closed viktor-yunenko closed 4 years ago

viktor-yunenko commented 4 years ago

not copiable:

Copying the whole page using Page -> Create Page -> Duplicate this Page action works normally though.

My current assumption is that adding self._form_field_key_cache = {} to the copyt_relations method might help. Although I wasn't able to reproduce the issue locally in order to confirm it.

Environment:

Full error

``` Environment: Request Method: GET Request URL: https://dectris-website.eu.aldryn.io/support/support-request/pilatus/pilatus3-processing-unit/ Django Version: 2.2.8 Python Version: 3.6.8 Installed Applications: ['backend.plugins.dectris.djangocms_bootstrap4_override', 'backend.plugins.dectris.aldryn_forms_override', 'backend.plugins.dectris.djangocms_file_override', 'backend.auth', 'aldryn_addons', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'aldryn_sso', 'djangocms_admin_style', 'django.contrib.admin', 'django.contrib.staticfiles', 'aldryn_django', 'aldryn_sites', 'djangocms_modules', 'cms', 'aldryn_django_cms', 'menus', 'sekizai', 'treebeard', 'parler', 'aldryn_boilerplates', 'django.contrib.sitemaps', 'compressor', 'robots', 'captcha', 'django_select2', 'filer.contrib.django_cms', 'djangocms_file', 'djangocms_googlemap', 'djangocms_history', 'djangocms_link', 'djangocms_picture', 'djangocms_snippet', 'djangocms_style', 'djangocms_video', 'filer', 'easy_thumbnails', 'mptt', 'polymorphic', 'allauth', 'allauth.account', 'allauth.socialaccount', 'cuser', 'gtm', 'solo', 'rest_framework', 'import_export', 'adminsortable2', 'admin_reorder', 'django_extensions', 'django_countries', 'snowpenguin.django.recaptcha2', 'widget_tweaks', 'aldryn_apphooks_config', 'djangocms_icon', 'djangocms_text_ckeditor', 'aldryn_forms_bs4_templates', 'djangocms_redirect', 'aldryn_forms', 'aldryn_forms.contrib.email_notifications', 'emailit', 'absolute', 'djangocms_bootstrap4', 'djangocms_bootstrap4.contrib.bootstrap4_alerts', 'djangocms_bootstrap4.contrib.bootstrap4_badge', 'djangocms_bootstrap4.contrib.bootstrap4_card', 'djangocms_bootstrap4.contrib.bootstrap4_carousel', 'djangocms_bootstrap4.contrib.bootstrap4_collapse', 'djangocms_bootstrap4.contrib.bootstrap4_content', 'djangocms_bootstrap4.contrib.bootstrap4_grid', 'djangocms_bootstrap4.contrib.bootstrap4_jumbotron', 'djangocms_bootstrap4.contrib.bootstrap4_link', 'djangocms_bootstrap4.contrib.bootstrap4_listgroup', 'djangocms_bootstrap4.contrib.bootstrap4_media', 'djangocms_bootstrap4.contrib.bootstrap4_picture', 'djangocms_bootstrap4.contrib.bootstrap4_tabs', 'djangocms_bootstrap4.contrib.bootstrap4_utilities', 'backend.plugins.default.bs4_float', 'backend.plugins.default.bs4_hiding', 'backend.plugins.default.bs4_inline_alignment', 'backend.plugins.default.bs4_spacer', 'backend.plugins.default.bs4_lightbox_gallery', 'backend.plugins.default.bs4_card_columns', 'backend.plugins.default.section_element', 'backend.plugins.default.image_with_content', 'backend.plugins.dectris.header', 'backend.plugins.dectris.accordion', 'backend.plugins.dectris.horizontal_line', 'backend.plugins.dectris.siblings_menu', 'backend.plugins.dectris.newsletter', 'backend.plugins.dectris.tiles', 'backend.plugins.dectris.header_slider', 'backend.plugins.dectris.aldryn_forms_extensions', 'backend.plugins.dectris.heading_element', 'backend.plugins.dectris.social_network_links', 'backend.error_handler', 'backend.shared', 'backend.products', 'backend.articles', 'backend.events'] Installed Middleware: ['cms.middleware.utils.ApphookReloadMiddleware', 'django.middleware.gzip.GZipMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'aldryn_sso.middleware.AccessControlMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.sites.middleware.CurrentSiteMiddleware', 'aldryn_sites.middleware.SiteMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'cms.middleware.user.CurrentUserMiddleware', 'cms.middleware.page.CurrentPageMiddleware', 'cms.middleware.toolbar.ToolbarMiddleware', 'cms.middleware.language.LanguageCookieMiddleware', 'admin_reorder.middleware.ModelAdminReorder', 'djangocms_redirect.middleware.RedirectMiddleware'] Traceback: File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 145. response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 143. response = response.render() File "/usr/local/lib/python3.6/site-packages/django/template/response.py" in render 106. self.content = self.rendered_content File "/usr/local/lib/python3.6/site-packages/django/template/response.py" in rendered_content 83. content = template.render(context, self._request) File "/usr/local/lib/python3.6/site-packages/django/template/backends/django.py" in render 61. return self.template.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 171. return self._render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render 163. return self.nodelist.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated 904. return self.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render 150. return compiled_parent._render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render 163. return self.nodelist.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated 904. return self.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render 150. return compiled_parent._render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render 163. return self.nodelist.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated 904. return self.render(context) File "/usr/local/lib/python3.6/site-packages/classytags/core.py" in render 153. return self.render_tag(context, **kwargs) File "/usr/local/lib/python3.6/site-packages/sekizai/templatetags/sekizai_tags.py" in render_tag 89. rendered_contents = nodelist.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated 904. return self.render(context) File "/usr/local/lib/python3.6/site-packages/classytags/core.py" in render 153. return self.render_tag(context, **kwargs) File "/usr/local/lib/python3.6/site-packages/sekizai/templatetags/sekizai_tags.py" in render_tag 89. rendered_contents = nodelist.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated 904. return self.render(context) File "/usr/local/lib/python3.6/site-packages/classytags/core.py" in render 153. return self.render_tag(context, **kwargs) File "/usr/local/lib/python3.6/site-packages/sekizai/templatetags/sekizai_tags.py" in render_tag 89. rendered_contents = nodelist.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated 904. return self.render(context) File "/usr/local/lib/python3.6/site-packages/classytags/core.py" in render 153. return self.render_tag(context, **kwargs) File "/usr/local/lib/python3.6/site-packages/cms/templatetags/cms_tags.py" in render_tag 447. return toolbar.render_with_structure(context, nodelist) File "/usr/local/lib/python3.6/site-packages/cms/toolbar/toolbar.py" in render_with_structure 477. rendered_contents = nodelist.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated 904. return self.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render 62. result = block.nodelist.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated 904. return self.render(context) File "/usr/local/lib/python3.6/site-packages/classytags/core.py" in render 153. return self.render_tag(context, **kwargs) File "/usr/local/lib/python3.6/site-packages/cms/templatetags/cms_tags.py" in render_tag 313. nodelist=nodelist, File "/usr/local/lib/python3.6/site-packages/cms/plugin_rendering.py" in render_page_placeholder 343. nodelist=None, File "/usr/local/lib/python3.6/site-packages/cms/plugin_rendering.py" in render_placeholder 259. placeholder_content = ''.join(plugin_content) File "/usr/local/lib/python3.6/site-packages/cms/plugin_rendering.py" in render_plugins 456. yield self.render_plugin(plugin, context, placeholder, editable) File "/usr/local/lib/python3.6/site-packages/cms/plugin_rendering.py" in render_plugin 435. content = template.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/backends/django.py" in render 61. return self.template.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 171. return self._render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render 163. return self.nodelist.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated 904. return self.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/defaulttags.py" in render 309. return nodelist.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render 937. bit = node.render_annotated(context) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated 904. return self.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/defaulttags.py" in render 209. nodelist.append(node.render_annotated(context)) File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated 904. return self.render(context) File "/usr/local/lib/python3.6/site-packages/django/template/library.py" in render 192. output = self.func(*resolved_args, **resolved_kwargs) File "/usr/local/lib/python3.6/site-packages/cms/templatetags/cms_tags.py" in render_plugin 199. editable=renderer._placeholders_are_editable, File "/usr/local/lib/python3.6/site-packages/cms/plugin_rendering.py" in render_plugin 429. context = plugin.render(context, instance, placeholder.slot) File "/usr/local/lib/python3.6/site-packages/aldryn_forms/cms_plugins.py" in render 371. field_name = form_plugin.get_form_field_name(field=instance) File "/usr/local/lib/python3.6/site-packages/aldryn_forms/models.py" in get_form_field_name 293. return self._form_field_key_cache[field.pk] Exception Type: KeyError at /support/support-request/pilatus/pilatus3-processing-unit/ Exception Value: 6746 ```
viktor-yunenko commented 4 years ago

Closing as a duplicate of #167