I just want to fetch the upper data only and then delete it in one action. I tried this code:
`def Data(request):
data = Plan.objects.get(id = 1)
data.delete()
context = {'data':data}
return render(request,'data.html',context)`
But didn't work.
CodePudding user response:
I don't understand, what is not works. Try to write a little bit more about your problem. Probably this can help:
def Data(request):
data = Plan.objects.get(id = 1)
Plan.objects.filter(id = 1).delete()
return render(request,'data.html',{'data':data})`