Skip to content

Commit

Permalink
Merge pull request #266 from Georiviere/fix_multipart_sent_data
Browse files Browse the repository at this point in the history
Fix multipart sent data
  • Loading branch information
submarcos authored Jul 3, 2024
2 parents 6ae79e7 + 21c08dd commit fd1b6b5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
CHANGELOG
=========

1.4.3 (2024-07-02)
---------------------

**Bug fix**

- Fix to give multipart data as JSON data in custom contribution API


1.4.2 (2024-07-02)
---------------------

Expand Down
2 changes: 1 addition & 1 deletion georiviere/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.2
1.4.3
4 changes: 2 additions & 2 deletions georiviere/portal/tests/test_views/test_contribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ def test_no_values_on_not_required(self):
"""Null and empty values should be accepted on non required fields"""
data = {
"station": self.station.pk,
self.string_field.key: None,
self.string_field.key: "",
self.string_field_blank.key: "",
"field_boolean": None,
"field_boolean": "",
"field_float": 1.1,
"contributed_at": "2020-01-01T00:00"
}
Expand Down
2 changes: 1 addition & 1 deletion georiviere/portal/views/contribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def create_contribution(self, request, *args, **kwargs):
custom_type = self.get_object()
context["custom_type"] = custom_type
# as data come from form, we need to clean None values in creation mode
data = {k: v for k, v in request.data.items() if v is not None}
data = {k: v for k, v in request.data.items() if v}
serializer = self.get_serializer(data=data, context=context)
if not serializer.is_valid():
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Expand Down

0 comments on commit fd1b6b5

Please sign in to comment.