Created
September 21, 2015 22:03
-
-
Save iopsthecloud/9db2a8185966b01ee8e9 to your computer and use it in GitHub Desktop.
workaround of https://github.com/brack3t/django-braces/issues/181
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CategoryCreateView(GroupRequiredMixin, CreateView): | |
| template_name = "catalogs/category/create.html" | |
| model = Category | |
| group_required = [u"admin", u"supervisor"] | |
| login_url = '/error/' | |
| raise_exception = True | |
| redirect_unauthenticated_users = True | |
| (...) | |
| class PermissionDeniedView(TemplateView): | |
| template_name = "core/error.html" | |
| def dispatch(self, request, *args, **kwargs): | |
| if request.user.is_authenticated() is False: | |
| redirect_to = request.GET.get('next', None) | |
| if redirect_to is not None: | |
| return redirect(reverse('authorization:login') + "?next=%s" % redirect_to) | |
| return redirect(reverse('authorization:login')) | |
| return super(PermissionDeniedView, self).dispatch(request, *args, **kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment