Thanks for replying so quickly. It looks like you're right and the login page isn't actually logging users in.
Any idea why that might be? I'm using the auth.login view and a template that looks like this: ##login.html {% extends "base.html" %} {% block content %} {% if form.errors %} <p>Your username and password didn't match. Please try again.</p> {% endif %} <form method="post" action="{% url django.contrib.auth.views.login %}"> <table> <tr> <td>{{ form.username.label_tag }}</td> <td>{{ form.username }}</td> </tr> <tr> <td>{{ form.password.label_tag }}</td> <td>{{ form.password }}</td> </tr> </table> <input type="submit" value="login" /> <input type="hidden" name="next" value="{{ next }}" /> </form> {% endblock %} ## It all displays correctly. And like I wrote before, the redirect screen IS displaying the correct user name, but now all the other pages kick them back to the login page. Any thoughts on what might be going on here? It's entirely possible (likely, even) that I just screwed something up in a very basic way. On Jun 3, 10:47 am, Jashugan <jashu...@gmail.com> wrote: > 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 -~----------~----~----~----~------~----~------~--~---