<p>I am working on a small intranet site for a small company, where user should be able to post. I have imagined a very simple authentication mechanism where people just enter their email address, and gets sent a unique login url, that sets a cookie that will always identify them for future requests.</p>

<p>In my template setup, I have base.html, and the other pages extend this. I want to show logged in or register button in the base.html, but how can I ensure that the necessary variables are always a part of the context? It seems that each view just sets up the context as they like, and there is no global context population. Is there a way of doing this without including the user in each context creation?</p>

<p>Or will I have to make my own custom shortcuts to setup the context properly?</p>

If you can hook your authentication into the
Django authentication scheme
you'll be able to use
```
request.user
```
.
I think this should just be a case of calling
```
authenticate()
```
and
```
login()
```
based on the contents of your Cookie.
Edit: @Staale - I always use the
```
locals()
```
trick
for my context so all my templates can see
```
request
```
and so
```
request.user
```
.  If you're not then I guess it wouldn't be so straightforward.