擅长:python、mysql、java
<p>您以错误的方式使用序列化程序和视图。你知道吗</p>
<p>您的<code>PalletDetail</code>视图的问题是使用了错误的查询集。queryset应该返回<code>Pallet</code>对象,因为查找将在该queryset上(默认的查找字段是'pk')。此外,您还需要使用<code>Pallet</code>的序列化程序,因为它应该处理<code>Pallet</code>对象的数据。你知道吗</p>
<pre><code>class PalletDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Pallet.objects.all()
serializer_class = PalletSerializer
</code></pre>