Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST 400 (Bad Request) #75

Open
sfornengo opened this issue Aug 2, 2019 · 1 comment
Open

POST 400 (Bad Request) #75

sfornengo opened this issue Aug 2, 2019 · 1 comment

Comments

@sfornengo
Copy link

python 3.7.3
django 2.2.3
djangorestframework 3.9.4
djangorestframework-bulk 0.2.1

class Milestone(models.Model): project = models.ForeignKey(Project, on_delete=models.CASCADE) position = models.IntegerField(default=0) name = models.CharField(max_length=100, default='')

class MilestoneSerializer(BulkSerializerMixin, serializers.ModelSerializer): class Meta: model = Milestone fields = ['id','project', 'position', 'name',] list_serializer_class = BulkListSerializer

class MilestoneViewSet(BulkModelViewSet): queryset = Milestone.objects.all() serializer_class = MilestoneSerializer

work when posting one object:
data={'project':4,'position':21,'name':'test'}
but it does not work posting two objects:
data=[{'project':4,'position':21,'name':'test'},{'project':4,'position':22,'name':'test'}]

Can someone explain if it is a bug or I miss something ?

@bhargava-kush
Copy link

Any update ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants