diff options
Diffstat (limited to 'app/notes/views.py')
-rw-r--r-- | app/notes/views.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/notes/views.py b/app/notes/views.py index 86ad574..7c8f6d8 100644 --- a/app/notes/views.py +++ b/app/notes/views.py @@ -20,6 +20,9 @@ class NoteCreateView(CreateView): def get_success_url(self): return reverse('posts:detail', kwargs={"pk": self.object.post.pk}) + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super(NoteCreateView, self).dispatch(*args, **kwargs) class NoteUpdateView(UpdateView): model = Note @@ -33,6 +36,9 @@ class NoteUpdateView(UpdateView): def get_success_url(self): return reverse('posts:detail', kwargs={"pk": self.object.post.pk}) + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super(NoteUpdateView, self).dispatch(*args, **kwargs) class NoteListView(ListView): model = Note @@ -47,3 +53,8 @@ class NoteListView(ListView): qs = Note.objects.filter(user=self.request.user).filter(status=status_reverse[status]) qs = Note.objects.filter(user=self.request.user) return qs + + + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super(NoteListView, self).dispatch(*args, **kwargs) |