Error in forms listing in admin
See original GitHub issueIssue Summary
I have a site which i was working well with wagtail -2.16.x, i’m making a renewal and migration of the whole site, i have a few forms, but when i did try to test it, seems to work twice, but when i look in admin section ‘Forms’ an error appears about ‘str’ object is not a mapping
Steps to Reproduce
- Start a new project with
wagtail start myproject
- Edit models.py to add a AbstractFormField model, and a AbstractEmailForm model:
class FormularioFormField(AbstractFormField): pagina = ParentalKey(“Formulario”, on_delete=models.CASCADE, related_name=“campos_formulario”) …
class Formulario(PaginaBaseAbstract, AbstractEmailForm): …
- Create a few pages in admin of type ‘Formulario’
- Go to public view fo that form and fill a few forms.
- return to wagtail admin, and go to forms
- open your forms with data filled
- see that error jumps…
- I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: YES
Technical details
- Python version: 3.10
- Django version: 4.0.1
- Wagtail version: 3.0
- Browser version: Firefox 99
btw, i found the solution, in the file wagtail/contrib/forms/models.py
line 57 (into get_data func):
**self.form_data,
def get_data(self):
"""
Returns dict with form data.
You can override this method to add additional data.
"""
return {
**self.form_data,
"submit_time": self.submit_time,
}
checking the same file in 2.16 y change a bit to make it similar, so i change it to:
def get_data(self):
form_data = json.loads(self.form_data)
form_data.update({'submit_time': self.submit_time})
return form_data
obviously must import json first
Issue Analytics
- State:
- Created a year ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Error in form - WordPress.org
I have 2 forms using Fluent Forms on my page, 1 has no problem, but the other has a console error even though...
Read more >errors in fields not displaying on Django admin form
I have checked all the fields in the model, and all the required fields have been filled out. Nevertheless, I continue to get...
Read more >Admin information - Microsoft Forms Admin
This article answers the most Frequently Asked Questions about admin information for Microsoft Forms.
Read more >Submitting form via admin-post.php and handling errors
I'm submitting this form using admin-post.php . Inside functions.php I have my function to process the form, which is working. I can display...
Read more >Errors in fields not displaying on Django admin form - Edureka
at the top of the form, yet no fields are highlighted with an error message. What can be another cause, and how do...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For reference, the same thing has been reported on the Wagtail Slack support channel but is unresolved there - if this does turn out to be a missed step in the upgrade process then we should highlight this in the release notes.
I just ran into this issue too. It looks like I had a bad record in the database. I guess that record was created after the migration ran to convert the table to JSON but before I had updated the
process_form_submission
to not usejson.dumps
anymore.Here you can see the bad record in the database with id 4.