i don't know what to do error: assert not inspect.isclass(self.child), '`child` has not been instantiated.' AssertionError: `child` has not been instantiated.
i got the data and want to make Owner and Manager data and connect M2M between Owner and Manager by OwnerCreateSerializer Please Help Me!!!! data = { "managers": [ { "name": "react", "department": "develop", "position": "PM", "phone_number": "01022145512", "email": "s...@gmail.com" }, { "name": "ajax", "department": "market", "position": "engineer", "phone_number": "01032145567", "email": "g...@gmail.com" } ], "business_license_number": "asdsasasssdsa", "business_store_type": "online", "business_condition": "service", "joined_date": "2021-02-02", "business_classification": "personal", "business_name": "doldam", "business_main_item": "food", "application_route": "0001", "sales_channel": "0", "transaction_amount": null, "past_pg_company": "", "business_official_address": "", "business_real_address": "", "initial_registration_fee": 0, "annual_management_fee": 0, "guarantee_insurance_policy": true, "contact_receipt": false, "contact_current_status": "ct_consult", "contact_type": "normal" } ------------------------------------------------------------------- models.py class Owner(models.Model): joined_date = models.DateField("접수일", auto_now_add=True) business_classification = models.CharField("사업체구분", max_length=100) business_name = models.CharField("상호명", max_length=100) business_main_item = models.CharField('주요판매물품', max_length=100) application_route = models.CharField("접수경로", max_length=100, ) sales_channel = models.CharField("영업채널", max_length=100, blank=True) class Manager(models.Model): owners = models.ManyToManyField(Owner, related_name='managers', blank=True, help_text='사업자등록') name = models.CharField('담당자이름', max_length=100) department = models.CharField('담당자부서', max_length=100) position = models.CharField('담당자직책', max_length=100) phone_number = models.CharField('담당자핸드폰번호', max_length=100, ) email = models.EmailField("담당자_EMAIL", max_length=255) ------------------------------------------------------------------- serializers.py class OwnerCreateSerializer(ModelSerializer): managers = serializers.ListField( child=serializers.DictField() ) class Meta: model = Owner fields = '__all__' def create(self, validated_data): managers = validated_data.pop('managers', None) owner = super().create(validated_data) managers_serializer= ManagerSerializer(data=managers,many=True) if managers_serializer.is_valid(): managers_serializer.save(owner) return owner ------------------------------------------------------------------- views.py class OwnerListCreate(APIView): def post(self, request): owner_serializer = OwnerCreateSerializer(data=request.data) if owner_serializer.is_valid(): owner_serializer.save() return Response(owner_serializer.data) -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/cac4bb14-1ae8-4bb5-a9a5-1a1f766f0d70n%40googlegroups.com.