發表文章

目前顯示的是 2月 9, 2019的文章

Django REST Framework Serialization POST is slow

圖片
2 I am running on Django 2.1.1 and Python 3.6.5 and am performing a reasonably large POST operation (32,000 JSON objects). I have the following: Model: class Data(models.Model): investigation = models.ForeignKey(Investigation) usage = models.FloatField() sector = models.CharField(max_length=100, blank=False, default='') cost = models.FloatField() demand = models.FloatField() Serializer: class DataSerializer(serializers.ModelSerializer): class Meta: model = Data fields = ('investigation', 'usage', 'sector', 'cost', 'demand') View: class DataView(generics.CreateAPIView): def create(self, request, pk, format=None): data_serializer = DataSerializer(data=request.data, many=True) if data_se...