On Mon, Oct 10, 2011 at 12:30 PM, Cal Leeming [Simplicity Media Ltd] < [email protected]> wrote:
> Hi Peter, > > You need to be using the RequestContext middleware - see 'option #1' on the > following: > ^^^ sorry - I misused the word middleware - possibly cos I was thinking about 'django.core.context_processors.csrf' at the same time. > > > http://lincolnloop.com/blog/2008/may/10/getting-requestcontext-your-templates/ > > Once you've got that, you can then use {{request.META}} within your > templates. > > There is also a how to here, which shows the 'ip_address' as an example. > > https://docs.djangoproject.com/en/1.3/ref/templates/api/ > > But in my personal opinion (in this particular example) using an additional > processor is a bit pointless (unless the header is dynamic, in which case > you'd use middleware anyway :X) > > Hope this helps. > > Cal > > On Mon, Oct 10, 2011 at 11:17 AM, peter-ctp <[email protected]>wrote: > >> Folks >> I am using the standard django authentication to allow people access >> to various web resources. I manage the password/username logins >> through the template login.html file and almost everything works fine. >> >> However: I would like to show the IP address of the user's computer, >> as it is seen by the django authentication module. That is: the IP >> address returned by request.META.get('REMOTE_ADDR') in the standard >> django request process. How can I show this somehow in the screen >> seen by the user? (the easiest would to be able to write this directly >> into the login.html script, something like.. >> <p>Your IP address is {{ipaddress}}</p> >> or >> <p>Your IP address is {{form.ipaddress}}</p> >> >> Help! >> >> Peter >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to [email protected]. >> 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. >> >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. 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.

