Django rest framework Django Rest Framework ManyToManyField ModelSerializer数据格式

Django rest framework Django Rest Framework ManyToManyField ModelSerializer数据格式,django-rest-framework,django-orm,Django Rest Framework,Django Orm,附录数据的有效性如何?我正在从一个php网站发送数据,并尝试了一些由DJF解析为以下格式的方法。两者都是无效的 'information.appendices.file.0' 'information.appendices.file[0]' class Information(models.Model): type = models.CharField(max_length=10) text = models.TextField(blank=True, null=True)

附录数据的有效性如何?我正在从一个php网站发送数据,并尝试了一些由DJF解析为以下格式的方法。两者都是无效的

'information.appendices.file.0'
'information.appendices.file[0]'

class Information(models.Model):
    type = models.CharField(max_length=10)
    text = models.TextField(blank=True, null=True)
    url = models.URLField(blank=True, null=True)
    appendices = models.ManyToManyField('Appendix')


class Appendix(models.Model):
    file = models.FileField(upload_to='information/appendices')


class AddInformationSerializer(ModelSerializer):
    appendices = AppendixSerializer(many=True, required=False)

您是否尝试在视图中将解析器类设置为?您要发送哪个
内容类型
标题?已使用MultiPartParser,且内容类型为multipart。