Show error message if not allowed to access admin page.

This commit is contained in:
2018-12-29 17:18:54 +02:00
parent 8eca3dc7a9
commit 05ecb6a493
2 changed files with 9 additions and 7 deletions

View File

@ -24,12 +24,6 @@ class AdminSettingsView(LoginRequiredMixin, FormView):
template_name = 'YtManagerApp/settings_admin.html'
success_url = reverse_lazy('home')
def get(self, request, *args, **kwargs):
if not request.user.is_authenticated or not request.user.is_superuser:
return HttpResponseForbidden()
return super().get(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
if not request.user.is_authenticated or not request.user.is_superuser:
return HttpResponseForbidden()