Bad Request 400 Error in Volto

Good afternoon Plone community!

I am currently in the process of enabling content types originally made in Plone classic to work in the Volto Frontend. There was an error when I tried submitting a form in the datagridfields. My guess is that it has something to do with the fact that the backend is looking to submit content created in the frontend, however, the format that is being used is not supported both ways. The full traceback is below:

2021-07-29 14:45:18,173 ERROR   [Zope.SiteErrorLog:252][waitress-3] 1627584318.1698360.5652646630925441 http://localhost:3000/POST_application_json_
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 371, in publish_module
  Module ZPublisher.WSGIPublisher, line 274, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
  Module, line 22, in __call__
  Module, line 19, in render
  Module, line 79, in reply
  Module plone.restapi.deserializer.dxcontent, line 59, in __call__
zExceptions.BadRequest: [{'message': 'Wrong contained type', 'field': 'school', 'error': 'ValidationError'}, {'message': 'Wrong contained type', 'field': 'employerAddress', 'error': 'ValidationError'}, {'message': 'Wrong contained type', 'field': 'references', 'error': 'ValidationError'}]

In addition, this is the configuration I had set up for each of the widgets:

import DataGridFieldWidget from './Widgets/DataGridFieldWidget';

const applyConfig = (config) => {
  config.widgets.factory.list = DataGridFieldWidget;
  return config;

export default applyConfig;

Currently, I am in the process of making a custom version of the ObjectListWidget as a DataGridFieldWidget. However, I am running into an error with the post action in Volto. It works fine in Plone classic as there were no errors or problems. Is there a way to convert a python Dict into a json file format?

I thank you kindly.



You know, I was wondering the same thing the other day, if I can use a "native" dexterity field coupled with an ObjectListWidget. I've decided to stick with JSONField, though, not to overcomplicate things.

If you have already existing data created by the "classic" DataGridField, you'd have to migrate it to a JSON format.

@tiberiuichim, Thank you for your reply.

Where would I go to find an example on migrating dexterity content to a JSON format?

I thank you kindly.



Plone Foundation Code of Conduct