class BOMView(View):

    def get(self,request):
        obj=BOMForm()
        return render(request,'bom.html',{'obj':obj})

    def post(self,request):
        data={
            'father':'CC',
            'son':'DD',
            'usage':2.0
        }
        obj=BOMSheet.objects.create(usage=data['usage'])
        father_id=ItemSheet.objects.filter(item=data['father']).first().id
        son_id=ItemSheet.objects.filter(item=data['son']).first().id
        obj.father.add(father_id)
        obj.son.add(son_id)
        obj.save()
        return HttpResponse('ok')

  

 

总结: 好麻烦.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2021-11-19
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2022-03-05
猜你喜欢
  • 2022-12-23
  • 2021-12-27
  • 2021-08-07
  • 2022-03-05
  • 2022-12-23
相关资源
相似解决方案