mirror of
https://github.com/Sosokker/ku-polls.git
synced 2025-12-19 21:44:06 +01:00
Redirect when non-Authenticate User go to detail/result
This commit is contained in:
parent
01ea565859
commit
20a1d6c0fd
@ -4,6 +4,7 @@ from django.urls import reverse
|
||||
from django.views import generic
|
||||
from django.utils import timezone
|
||||
from django.urls import reverse_lazy
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
|
||||
from .forms import SignUpForm
|
||||
from .models import Choice, Question
|
||||
@ -22,7 +23,7 @@ class IndexView(generic.ListView):
|
||||
)[:5]
|
||||
|
||||
|
||||
class DetailView(generic.DetailView):
|
||||
class DetailView(LoginRequiredMixin, generic.DetailView):
|
||||
"""
|
||||
Provide a view for detail page, a detail for each poll contain poll question
|
||||
and poll choices.
|
||||
@ -54,7 +55,7 @@ class DetailView(generic.DetailView):
|
||||
return context
|
||||
|
||||
|
||||
class ResultsView(generic.DetailView):
|
||||
class ResultsView(LoginRequiredMixin, generic.DetailView):
|
||||
model = Question
|
||||
template_name = "polls/results.html"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user