Context in render breaks extended template

If i have a render like:

return render(request, ‘authldap.html’, context)

The {% extends “admin/base_site.html” %} in authldap.html breaks. Essentially just css styling and a topnav bar.

If I go to return render(request, ‘authldap.html’)

the Extend works just fine. topnav bar is there.

What is in context?

         server = "bob"
            user = "bob"
            secret = "bob"
            basedn = "bob"
            binddn = "bob"

context = {'server': server, 'user': user, 'secret': secret, 'basedn': basedn, 'binddn': binddn}

That is enough for it to break the extend. but the context does fill in correctly.

What’s even more curious, i have multiple other templates which are essentially the same and they work fine. Otherwise the templates are very simple and default.

Welcome @tbiens !

We’ll need to see more details here.

Specifically, please post here the lines of your base_site.html template that do not work when you pass in the context. This includes any conditional or iteration statements surrounding them as well.
(What physically changes in the page after rendering? What is different in the HTML between the two situations?)

What happens if you change the contents of the context being supplied? (One issue I see is that you have a naming conflict between your context ('user'), and the system-supplied auth context processor.) The first thing I’d try would be to remove your user from the context you are supplying.

1 Like

Im crying only a little. Not getting those hours back.

You’re correct, user variable in context had a conflict. Problem solved.

Thank you.