I'd like to output some information that depends on session data in Django. Let's take a "Login" / "Logged in as | Logout" fragment for example. It depends on my request.session['user']
.
Of course I can put a user object in the context every time I render a page and then switch on {% if user %}
, but that seems to break DRY idea - I would have to add user to every context in every view.
How can I extract a fragment like that and make it more common?