coderedcorp / coderedcms

Wagtail + CodeRed Extensions enabling rapid development of marketing-focused websites.
https://www.coderedcorp.com/cms
Other
691 stars 134 forks source link

TypeError: 'str' object is not a mapping in Streamforms Forms Pages #542

Closed pbspm01 closed 6 months ago

pbspm01 commented 2 years ago

The saved form data on Forms Pages cannot be displayed for Streamforms, because of the following error:

Traceback (most recent call last): File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/django/views/decorators/cache.py", line 62, in _wrapped_view_func response = view_func(request, *args, *kwargs) File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/wagtail/admin/urls/init.py", line 161, in wrapper return view_func(request, args, kwargs) File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/wagtail/admin/auth.py", line 182, in decorated_view response = view_func(request, *args, kwargs) File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/wagtail/contrib/forms/views.py", line 23, in get_submissions_list_view return form_page.serve_submissions_list_view(request, *args, *kwargs) File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/coderedcms/models/page_models.py", line 1497, in serve_submissions_list_view return view(request, form_page=self, args, kwargs) File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/django/views/generic/base.py", line 84, in view return self.dispatch(request, *args, kwargs) File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/wagtail/contrib/forms/views.py", line 207, in dispatch return super().dispatch(request, *args, *kwargs) File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/django/views/generic/base.py", line 119, in dispatch return handler(request, args, kwargs) File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/django/views/generic/list.py", line 174, in get context = self.get_context_data() File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/wagtail/contrib/forms/views.py", line 310, in get_context_data form_data = submission.get_data() File "/home/coderedcms/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.9/site-packages/wagtail/contrib/forms/models.py", line 56, in get_data return {

TypeError: 'str' object is not a mapping


Running Codered 1.0.1

Have you seen this before?

vsalvino commented 2 years ago

Can you provide the steps to reproduce this error? E.g. What buttons were clicked in what order, or what code snippets were implemented, etc.

pbspm01 commented 2 years ago

Hi @vsalvino, I've done some tests, and I've found that the error comes on a vanilla install as well. Steps to reproduce: 1) Follow Codered install instructions at https://docs.coderedcorp.com/wagtail-crx/getting_started/install.html 2) Enable Stream Forms as https://docs.coderedcorp.com/wagtail-crx/features/page_types/stream_forms.html 3) makemigrations / migrate 4) Create a Stream Form (in my case it was single step, containing a Text and a Text input)

5) Check Form submissions -> no records, no error 6) Submit something in the form 7) Check Form submissions -> error

Here's the list of packages: anyascii 0.3.1 asgiref 3.5.2 beautifulsoup4 4.9.3 bleach 4.1.0 certifi 2022.9.24 chardet 5.0.0 charset-normalizer 2.1.1 click 8.1.3 coderedcms 1.0.1 decorator 5.1.1 Django 4.0.8 django-bootstrap4 22.2 django-bootstrap5 21.3 django-debug-toolbar 3.7.0 django-eventtools 1.0.3 django-extensions 3.2.1 django-filter 21.1 django-modelcluster 6.0 django-permissionedforms 0.1 django-sass 1.1.0 django-sendmail-backend 0.1.2 django-taggit 2.1.0 django-treebeard 4.5.1 djangorestframework 3.14.0 draftjs-exporter 2.1.7 et-xmlfile 1.1.0 future 0.18.2 geocoder 1.38.1 html5lib 1.1 icalendar 4.1.0 idna 3.4 importlib-metadata 5.0.0 jdcal 1.4.1 l18n 2021.3 libsass 0.21.0 Markdown 3.3.7 openpyxl 3.0.10 packaging 21.3 Pillow 9.2.0 pip 22.3.1 polib 1.1.1 pyparsing 3.0.9 python-dateutil 2.8.2 pytz 2022.5 ratelim 0.1.6 requests 2.28.1 selenium 3.141.0 setuptools 65.5.1 six 1.16.0 soupsieve 2.3.2.post1 sqlparse 0.4.3 tablib 3.2.1 telepath 0.3 typing_extensions 4.4.0 Unidecode 1.3.6 urllib3 1.26.12 wagtail 3.0.3 wagtail-cache 2.2.0 wagtail-localize 1.3.1 wagtail-markdown 0.10.0 wagtail-seo 2.3.0 wagtail-tag-manager 1.4.0 wagtail-transfer 0.8.5 wagtailfontawesome 1.2.1 waitress 2.1.2 webencodings 0.5.1 wheel 0.38.4 Willow 1.4.1 xlrd 2.0.1 XlsxWriter 3.0.3 xlwt 1.3.0 zipp 3.9.0

I know, this is more extensive than that is needed for a vanilla install. I've reused my original Pipfile. I'm pretty sure that Stream Forms worked on 0.25. But in that config the other packages were also older. (The ordinary Forms worked then, and work now without issues). TypeError at _admin_forms_submissions4.html.txt

vsalvino commented 1 year ago

Perfect, thanks for the details. I will investigate.

vsalvino commented 1 year ago

I think this issue was fixed in 1.0.3, for a bug that was introduced in 1.0.0. (#558)

If you have an existing site, can you try the fix in the release notes: https://docs.coderedcorp.com/wagtail-crx/releases/v1.0.3.html

Or on a new site, start with a vanilla install >=1.0.3

vsalvino commented 6 months ago

Closing this due to inactivity. Feel free to re-open if you are still experiencing the issue or have any new information. Thanks!