Add login_url for all LoginRequiredMixin views

This commit is contained in:
PCoder 2019-02-24 20:34:53 +01:00
parent 14949cedb7
commit a20e9479c8

View file

@ -97,6 +97,7 @@ class Register(View):
return render(request, 'usercreated.html', { 'user': username } ) return render(request, 'usercreated.html', { 'user': username } )
class ChangeData(LoginRequiredMixin, View): class ChangeData(LoginRequiredMixin, View):
login_url = reverse_lazy('login_index')
# provide the form for the change request # provide the form for the change request
def get(self, request): def get(self, request):
urlname = 'change_data' urlname = 'change_data'
@ -344,7 +345,7 @@ class ResetRequest(View):
# The logged in user can change the password here # The logged in user can change the password here
class ChangePassword(LoginRequiredMixin, View): class ChangePassword(LoginRequiredMixin, View):
login_url = reverse_lazy('login_index')
# Presents the page for a logged in user # Presents the page for a logged in user
def get(self, request): def get(self, request):
if not request.user.is_authenticated: if not request.user.is_authenticated:
@ -394,6 +395,7 @@ class ChangePassword(LoginRequiredMixin, View):
# Deletes an account # Deletes an account
class DeleteAccount(LoginRequiredMixin, View): class DeleteAccount(LoginRequiredMixin, View):
login_url = reverse_lazy('login_index')
# Show the basic form for deleting an account # Show the basic form for deleting an account
def get(self, request): def get(self, request):
return render(request, 'deleteaccount.html') return render(request, 'deleteaccount.html')