To do this, you simply make an AJAX call to your URL, and in the view that processes the URL, you must add the @login_required decorator. For some reason, the django project is working right now, so I will send you to another place where you can get information .
However, you will need to keep track of some things, but you need to add the CSRF token, and secondly, you need to make a few changes to the SETTINGS.PY file.
I think the video covers all of this, I'm sorry that I cannot send you to official documents, because it does not seem to be working right now.
source share