Skip to content

Commit

Permalink
fixes miki725#34
Browse files Browse the repository at this point in the history
  • Loading branch information
miki725 authored and blackrobot committed Nov 4, 2015
1 parent e1d01ca commit fa1e9fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions rest_framework_bulk/drf3/serializers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from __future__ import print_function, unicode_literals
import inspect

from rest_framework.exceptions import ValidationError
from rest_framework.serializers import ListSerializer

Expand Down Expand Up @@ -41,6 +43,10 @@ def update(self, queryset, all_validated_data):
for i in all_validated_data
}

if not all((bool(i) and not inspect.isclass(i)
for i in all_validated_data_by_id.keys())):
raise ValidationError('')

# since this method is given a queryset which can have many
# model instances, first find all objects to update
# and only then update the models
Expand Down
3 changes: 1 addition & 2 deletions rest_framework_bulk/tests/test_generics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import unicode_literals, print_function
import json
import unittest

from django.core.urlresolvers import reverse
from django.test import TestCase
Expand Down Expand Up @@ -85,7 +84,6 @@ def test_put(self):
]
)

@unittest.skip('')
def test_put_without_update_key(self):
"""
Test that PUT request updates all submitted resources.
Expand All @@ -94,6 +92,7 @@ def test_put_without_update_key(self):
'',
json.dumps([
{'contents': 'foo', 'number': 3},
{'contents': 'rainbows', 'number': 4}, # multiple objects without id
{'contents': 'bar', 'number': 4, 'id': 555}, # non-existing id
]),
content_type='application/json',
Expand Down

0 comments on commit fa1e9fa

Please sign in to comment.