diff options
Diffstat (limited to 'ishtar_common/views.py')
| -rw-r--r-- | ishtar_common/views.py | 8 | 
1 files changed, 7 insertions, 1 deletions
| diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 5f5b0be42..02966e88f 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -30,6 +30,7 @@ from django.apps import apps  from django.conf import settings  from django.contrib.auth import logout  from django.contrib.auth.decorators import login_required +from django.contrib.auth.views import redirect_to_login  from django.contrib.contenttypes.models import ContentType  from django.core.exceptions import ObjectDoesNotExist  from django.core.urlresolvers import reverse, NoReverseMatch @@ -1001,9 +1002,14 @@ class ProfileEdit(LoginRequiredMixin, FormView):          return HttpResponseRedirect(self.get_success_url()) -class DisplayItemView(IshtarMixin, LoginRequiredMixin, TemplateView): +class DisplayItemView(IshtarMixin, TemplateView):      template_name = 'ishtar/display_item.html' +    def dispatch(self, request, *args, **kwargs): +        if not self.request.user.is_authenticated: +            return redirect_to_login(reverse("display-item", kwargs=kwargs)) +        return super(DisplayItemView, self).dispatch(request, *args, **kwargs) +      def get_context_data(self, *args, **kwargs):          data = super(DisplayItemView, self).get_context_data(*args, **kwargs)          pk = unicode(kwargs.get('pk')) + '/' | 
