diff options
-rw-r--r-- | rpkid/rpki/gui/app/views.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/rpkid/rpki/gui/app/views.py b/rpkid/rpki/gui/app/views.py index 60a40e0a..077daf5a 100644 --- a/rpkid/rpki/gui/app/views.py +++ b/rpkid/rpki/gui/app/views.py @@ -28,6 +28,7 @@ import cStringIO import csv import logging +from django.utils.decorators import method_decorator from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404, render, redirect from django.utils.http import urlquote @@ -1253,12 +1254,22 @@ def user_edit(request, pk): class AlertListView(ListView): + # this nonsense is required to decorate CBVs + @method_decorator(handle_required) + def dispatch(*args, **kwargs): + return super(AlertDeleteView, self).dispatch(*args, **kwargs) + def get_queryset(self, **kwargs): conf = self.request.session['handle'] return conf.alerts.all() class AlertDetailView(DetailView): + # this nonsense is required to decorate CBVs + @method_decorator(handle_required) + def dispatch(*args, **kwargs): + return super(AlertDeleteView, self).dispatch(*args, **kwargs) + def get_queryset(self, **kwargs): conf = self.request.session['handle'] return conf.alerts.all() @@ -1274,6 +1285,11 @@ class AlertDetailView(DetailView): class AlertDeleteView(DeleteView): success_url = reverse_lazy('alert-list') + # this nonsense is required to decorate CBVs + @method_decorator(handle_required) + def dispatch(*args, **kwargs): + return super(AlertDeleteView, self).dispatch(*args, **kwargs) + def get_queryset(self, **kwargs): conf = self.request.session['handle'] return conf.alerts.all() |