def get(self, request, *args, **kwargs):
try:<EOL><INDENT>page = self.object = self.get_object()<EOL><DEDENT>except Http404:<EOL><INDENT>if settings.APPEND_SLASH and not self.kwargs.get('<STR_LIT:path>', '<STR_LIT:/>').endswith('<STR_LIT:/>'):<EOL><INDENT>return self._try_url_with_appended_slash()<EOL><DEDENT>else:<EOL><INDENT>raise Http404<EOL><DEDENT><DEDENT>if page.staff_only and not request.user.is_staff:<EOL><INDENT>return render(request, '<STR_LIT>', status=<NUM_LIT>)<EOL><DEDENT>if page.login_required and request.user.is_anonymous():<EOL><INDENT>redirect_url = '<STR_LIT>' % (settings.LOGIN_URL, self.kwargs.get('<STR_LIT:path>', '<STR_LIT>'))<EOL>return HttpResponseRedirect(redirect_url)<EOL><DEDENT>else:<EOL><INDENT>self.object = self._mark_html_fields_as_safe(self.object)<EOL>context = self.get_context_data(object=self.object)<EOL>return self.render_to_response(context, content_type=self.get_mimetype())<EOL><DEDENT>
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.