import user in django

from django.contrib.auth.mixins import LoginRequiredMixin

LOGIN_URL = 'your_url'

Here is what the above code is Doing:
1. We’re importing the LoginRequiredMixin class from Django.
2. We’re setting the LOGIN_URL variable to the URL we want to redirect users to if they aren’t logged in.
3. We’re adding the LoginRequiredMixin class to our class-based view.
4. We’re adding the login_url variable to our class-based view.