Swapped login required decorator for login required mixin
This commit is contained in:
parent
849b9bdbb7
commit
dae32a0bba
|
@ -1,5 +1,4 @@
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.utils.decorators import method_decorator
|
|
||||||
from django.core.mail import EmailMessage
|
from django.core.mail import EmailMessage
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from mhackspace.requests.forms import UserRequestForm
|
from mhackspace.requests.forms import UserRequestForm
|
||||||
|
@ -8,8 +7,7 @@ from django.views.generic import ListView
|
||||||
from django.views.generic.edit import FormView
|
from django.views.generic.edit import FormView
|
||||||
|
|
||||||
|
|
||||||
@method_decorator(login_required, name='dispatch')
|
class RequestsForm(LoginRequiredMixin, FormView):
|
||||||
class RequestsForm(FormView):
|
|
||||||
template_name = 'pages/requests.html'
|
template_name = 'pages/requests.html'
|
||||||
form_class = UserRequestForm
|
form_class = UserRequestForm
|
||||||
success_url = '/requests'
|
success_url = '/requests'
|
||||||
|
@ -30,8 +28,8 @@ class RequestsForm(FormView):
|
||||||
|
|
||||||
return super(FormView, self).form_valid(form)
|
return super(FormView, self).form_valid(form)
|
||||||
|
|
||||||
@method_decorator(login_required, name='dispatch')
|
|
||||||
class RequestsList(ListView):
|
class RequestsList(LoginRequiredMixin, ListView):
|
||||||
template_name = 'pages/requests.html'
|
template_name = 'pages/requests.html'
|
||||||
model = UserRequests
|
model = UserRequests
|
||||||
context_object_name = 'requests'
|
context_object_name = 'requests'
|
||||||
|
|
Loading…
Reference in New Issue