django-conduit
django-conduit copied to clipboard
Allow submitting empty data for related fields that are not required
If you have a related field that is not required and you don't submit that field in your data, you get a KeyError when Conduit tries to save the related object.
A request to a Conduit endpoint with an empty object for a FK creates an object with empty attributes and adds a resource_uri attribute that points to the list endpoint for the resource:
{
'id': 1,
'name': '',
'resource_uri': '/api/v1/bar/'
}
This change prevents creating a FK if no data is submitted in the request. If you omit data for a non-required FK field in your request data, then the response will return an empty object in the response:
{
...
'bar': {},
...
}
Currently working on a complete fix for this. Taking me a while to get back into the problem.