0👍
✅
The easiest way is to just overload the get
method:
class CompanyDeleteView(LoginRequiredMixin, generic.DeleteView):
model = Company
def get(self, request, *args, **kwargs):
return self.delete(request, *args, **kwargs)
3👍
Use JavaScript to show a pop-up when you click the delete button. In that pop-up, there will be a link to your delete view.
So instead of giving the link in delete button give a confirmation pop-up there and write the link in that pop-up.
<script>
function myFunction() {
var txt;
if (confirm("Do you want to delete!")) {
//go to your delete path
} else {
//don't do anything
}
}
</script>
In your button you can call this function like this
<button onclick="myFunction()">Delete it</button>
- [Django]-Run Django commands on Elastic Beanstalk SSH -> Missing environment variables
- [Django]-Radical Use of Admin's Interface
- [Django]-Prevent multiple logins using the same credentials
- [Django]-Django CMS how to create nested plugins programatically
- [Django]-Django Framework: Object does not display on web page for specific pk
Source:stackexchange.com