On Jun 2, 5:00 pm, Matt <matt.w...@gmail.com> wrote:
> //views.py
> from django.template import RequestContext
> def detail(request):
> ...
>     context = { 'employees': employees, 'entityinfo': entityinfo}
>     return render_to_response('results/resultstable.html',
> context_instance=RequestContext(request, context))
> //

First off, this is a little simpler way to go about it.

## views.py

from django.views.generic.simple import direct_to_template

def detail(request):
  ...
  return direct_to_template(request, 'results/resultstable.html')

direct_to_template will setup the request context for the templates

> The problem is my {{ user }} (which I'm using in base.html) isn't
> showing up in the majority of my pages. It shows up on all of the
> django-registration pages that start with "/accounts/." It also shows
> up on my index page, which is the redirect from the login page.

Are you logged in? The request context for the user won't show up if
the user isn't logged in.

> Here's the curveball: When I log in to the admin site, and then go to
> my project, everything works smashingly. I can go to all of my pages,
> and it says, "Hi, Matt!"

See above.

If you want to make sure that users are required to login, you should
use login_required (http://docs.djangoproject.com/en/dev/topics/
auth/):

## views.py

from django.views.generic.simple import direct_to_template

@login_required
def detail(request):
  ...
  return direct_to_template(request, 'results/resultstable.html')

If you want to just display the username, after someone has logged in.

## results/resultstable.html

{% if user %}Hi, {{ user }}{% endif %}



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to