After deleting an object from my DB I want to redirect to a certain view.
here is my view where the deletion happens:
def client_delete(request):
if request.method == 'GET':
return _not_exist_page(request)
else:
client = Client.objects.get(id=request.POST['id'])
client.delete()
print('deleted')
return redirect('clients:index')
print('deleted2')
when I delete an object here's what I see on the terminal:
deleted
[03/Apr/2018 15:55:50] "POST /clients/delete/ HTTP/1.1" 302 0
[03/Apr/2018 15:55:50] "GET /clients/ HTTP/1.1" 200 7467
it means that the redirect is triggered(and that's why the second print doesn't show up) but view in my browser doesn't change.
Any idea why that happens?
Thanks