Source

Lightning Talks / lightning / talks / views.py

Diff from to

lightning/talks/views.py

 
 
 class DeleteTalkView(DeleteView):
-    pass
+    model = Talk
+    slug_field = 'pk'
+
+    @method_decorator(login_required)
+    def dispatch(self, *args, **kwargs):
+        return super(DeleteTalkView, self).dispatch(*args, **kwargs)
+
+    def get_queryset(self):
+        queryset = super(DeleteTalkView, self).get_queryset()
+        queryset = queryset.filter(user=self.request.user)
+        return queryset
+
+    def get_success_url(self):
+        return reverse('talks')
 
 
 class CreateTalkView(CreateView):