多平台统一管理软件接口,如何实现多平台统一管理软件接口
296
2022-09-08
listview(listview控件)
class IdcView(ListView): model = Idcc context_object_name = "idcc" template_name = 'tm/idc.html' #paginate_by = 3 def get_context_data(self, *, object_list=None, **kwargs): context = super(IdcView, self).get_context_data(**kwargs) context['publication'] = '21112' context['budget'] = Idcc.objects.all() return contextclass IdcView(TemplateView): template_name = 'tm/idc.html' def get_context_data(self, **kwargs): idcs = Idcc.objects.all() return {'idcs':idcs} def post(self,request,*args,**kwargs): print(request.body) #data = QueryDict(request.body).dict() data = request.POST.dict() Idcc.objects.create(**data) status={'status':'1'} return JsonResponse(status) def delete(self,request,*args,**kwargs): pk=kwargs.get('pk') print(pk) Idcc.objects.get(id=pk).delete() status={'status':'1'} return JsonResponse(status) def put(self,request,*args,**kwargs): pk = kwargs.get('pk') data = QueryDict(request.body).dict() print(data) Idcc.objects.filter(id=pk).update(**data) status={'status':'1'} return JsonResponse(status)
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~