Home Features Philosophy Docs Blog Errors Security Examples FAQ
DJE-020 Warning Template

wrapper_template renders with empty context

Error message

Template renders but shows no data — no error raised

If a LiveView's wrapper_template references context variables that were never set in mount() or handle_event(), the template renders silently with empty values. There is no error or warning, making it hard to diagnose why the page appears blank.

silent-failure template

Affected versions: >=0.2.0

Solution

Before (problematic)
class DashboardView(LiveView):
    template_name = "dashboard.html"

    def mount(self, request):
        # Forgot to set self.items!
        pass

    # Template: {% for item in items %} ... renders nothing
After (fixed)
class DashboardView(LiveView):
    template_name = "dashboard.html"
    items = []  # Explicit default

    def mount(self, request):
        self.items = Item.objects.filter(
            user=request.user
        ).values("name", "status")