#24829: TemplateView raises unhandled ContentNotRenderedError error when used as error handler -------------------------------+------------------------------------ Reporter: nonZero | Owner: nobody Type: New feature | Status: new Component: Generic views | Version: master Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+------------------------------------
Comment (by nonZero): Regarding use case - our "permission denied" page includes the complete site layout - including navigation and user information resolved at a site wide mixin used also in the PermissionDeniedView. Examining the source code of [https://github.com/django/django/blob/d17a035132c4ddba51d57286b2185bc459f69067/django/template/response.py#L173 SimpleTemplateResponse], one solution could be removing ContentNotRenderedError, and call self.render() instead of raising it: {{{ if not self._is_rendered: self.render() }}} Why is ContentNotRenderedError needed? -- Ticket URL: <https://code.djangoproject.com/ticket/24829#comment:2> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.0266245080aa554fa2eb9d2206462011%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.