On Monday, June 18, 2012, Melvyn Sopacua wrote: > On 18-6-2012 9:52, Laurence MacNeill wrote: > > well -- I hit the wrong key and posted that before I was finished > typing... > > > > here's what's in my views.py file: > > def index(request) > > current_username = os.environ['REMOTE_USER'] > > And you're sure this works? Try: > return django.shortcuts.render_to_response(current_username) > > here to verify it's coming through. Normally, the authenticated username > would be part of the request dictionary.
Yeah, it's not working... How do I get the user-name from the request dictionary? request.REMOTE_USER or somthing like that? It's not using Django for the user-validation, though... When someone logs into the site, they get redirected to a page that validates them. This is controled by the Apache web-server itself -- if they try to access any document served by Apache, and they don't have a cookie on their computer, they're redirected to a different page where they enter their user ID and password, then are sent back to the original page. The user-id is then stored in a linux environment variable called REMOTE_USER. So I figured the only way to access it was via the os.environ method. > > Almost correct: > if student is not None : > # the student.html template will now have a variable named student > # which is the student object you fetched > return render_to_response('ta/student.html', student=student) > elif instructor is not None : > #etc Ahh, ok -- that makes sense... Thanks... L. -- 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.