diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/notes/views.py | 11 | ||||
-rw-r--r-- | app/posts/views.py | 3 |
2 files changed, 14 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) diff --git a/app/posts/views.py b/app/posts/views.py index 3c25483..3d01ad7 100644 --- a/app/posts/views.py +++ b/app/posts/views.py @@ -21,6 +21,9 @@ class PostListView(ListView): class PostNotesView(DetailView): model = Post + @method_decorator(login_required) + def dispatch(self, *args, **kwargs): + return super(PostNotesView, self).dispatch(*args, **kwargs) ''' class UpdateViewWithUser(UpdateView): |