|
@@ -1,5 +1,7 @@
|
|
|
from django.http import Http404
|
|
|
from django.shortcuts import render, redirect
|
|
|
+from django.utils.decorators import method_decorator
|
|
|
+from django.contrib.auth.decorators import login_required
|
|
|
from django.views.generic import View
|
|
|
from django.contrib import messages
|
|
|
from .forms import UserRegisterForm, StaffRegistrationForm, StaffSheetDateForm
|
|
@@ -48,6 +50,18 @@ class RegistrationView(View):
|
|
|
return render(request, 'signup.html', {'form': form})
|
|
|
|
|
|
|
|
|
+@method_decorator([login_required], name='dispatch')
|
|
|
+class LoginRedirectURL(View):
|
|
|
+
|
|
|
+ def dispatch(self, request, *args, **kwargs):
|
|
|
+ if not request.user.is_authenticated:
|
|
|
+ return redirect('login')
|
|
|
+ elif request.user.is_staff:
|
|
|
+ return redirect('un-replied-review')
|
|
|
+ else:
|
|
|
+ return redirect('location-analytics')
|
|
|
+
|
|
|
+
|
|
|
class LocationAnalytics(LoginRequiredMixin, View):
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
# print(dir(request.user))
|