1👍
✅
You are simply not returning the validated form to the template. Everytime in your view, you return a new instance of LoginPageDelete() instead and discard the one with validation information.
def delete(request):
if request.method == 'POST' and "DeleteButton" in request.POST:
form = LoginPageDelete(request.POST)
if form.is_valid():
DeleteData = form.cleaned_data
q = DeleteData["emailD"]
query = Users.objects.get(email = q )
query.delete()
fetch = Users.objects.all()
return render(request,'Result.html',{'QueryDelete':fetch.values(),})
else:# here request.method is get or in your case "DeleteButton" not in request.POST
form = LoginPageDelete()
return render(request,'delete.html',{"FormDelete":form})
👤keni
Source:stackexchange.com