Derek Hoy wrote: > Take a look at this: > http://www.djangoproject.com/documentation/authentication/#authentication-data-in-templates > > You can use this to put something in a base template that all your > site templates can be based on. > > Derek
Well, here's my sitewide template that everything else extends: ----------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>{% block title %}Title goes here{% endblock %}</title> </head> <body id="main"> {% if user.is_authenticated %} <p>Welcome, {{ user.username }}. Thanks for logging in.</p> {% else %} <p>Welcome, new user. Please <a href="http://www.example.com/ accounts/login/">log in</a>.</p> {% endif %} {% block content %}The author didn't have much to say.{% endblock %} </body> </html> ----------------------------------------------- Whenever I visit that page, I get the "Welcome, new user. Please log in." message. But if I click that link, I get this page template: ----------------------------------------------- {% extends "page_template.html" %} {% block content %} {% if form.has_errors %} <p>Your username and password didn't match. Please try again.</p> {% endif %} <form method="post" action=""> <table> <tr><td><label for="id_username">Username:</label></ td><td>{{ form.username }}</td></tr> <tr><td><label for="id_password">Password:</label></ td><td>{{ form.password }}</td></tr> </table> <input type="submit" value="login" /> <input type="hidden" name="next" value="http://www.example.com/" /> </form> {% endblock %} ----------------------------------------------- ...which yields the text "Welcome, kirk. Thanks for logging in." I'm finding this somewhat confusing in that page_template knows my name if I'm viewing the login page but not the main index.html. BTW, this is using Django 0.96 on FreeBSD 6-STABLE. -- Kirk Strauser --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---