Check user authentication if the page requires a login.

        We could do this by overriding dispatch() instead, but we assume
        that only GET requests will be required by the CMS pages.

def get(self, request, *args, **kwargs):
        """
        Check user authentication if the page requires a login.

        We could do this by overriding dispatch() instead, but we assume
        that only GET requests will be required by the CMS pages.
        """
        try:
            page = self.object = self.get_object()
        except Http404:
            # If APPEND_SLASH is set and our url has no trailing slash,
            # look for a CMS page at the alternate url:
            if settings.APPEND_SLASH and not self.kwargs.get('path', '/').endswith('/'):
                return self._try_url_with_appended_slash()
            else:
                raise Http404

        # Check request.user's credentials in accessing this page:
        if page.staff_only and not request.user.is_staff:
            # Block out non-staff users on restricted pages.
            # Django 1.4 will introduce better HTTP 403 support, but until then
            # we'll just render a plain "permission denied" template (which can be overridden):
            return render(request, 'turrentine/403.html', status=403)
        if page.login_required and request.user.is_anonymous():
            redirect_url = '%s?next=%s' % (settings.LOGIN_URL, self.kwargs.get('path', ''))
            return HttpResponseRedirect(redirect_url)
        else:
            self.object = self._mark_html_fields_as_safe(self.object)
            context = self.get_context_data(object=self.object)
            return self.render_to_response(context, content_type=self.get_mimetype())