we can decorate a view with login_required so that unauthenticated user would be redirected to a login page.
I'd like to create a decorator to show a modal in the current page when an unauthenticated user accesses a view.
I guess I can handle when request is made with ajax.
I could use $.ajaxSetup to handle 401 errors to show the modal.
But how do I show a modal when a regular request is made?
Edit
Similar question is asked, Django authentication and Ajax - URLs that require login
But it only covers the ajax requests.