using  request.META['REMOTE_ADDR']

and the passing ur request through custom middleware might solve your
problem

Ex:
You can have a standard user let say "internal" which you can put into your
request if
it comes from internal IP

inside middleware.

from django.contrib.auth import login, authenticate

def process_request(self,request):
 if(request.META['REMOTE_ADDR'] == "127.0.0.1"):
  usr = authenticate(username="internal",password="password")
  login(request,usr)
 return  None

The code is just a snippet not verified. please make appropriate changes.

Regards,
//Vikalp


in request.META['REMOTE_ADDR']








On Fri, Aug 13, 2010 at 12:16 AM, Alessandro Ronchi <
alessandro.ron...@soasi.com> wrote:

> I want to limit a django view to be accessible for staff users or free
> (without autentication) for a single ip.
>
> Is it possible?
>
>
> --
> Alessandro Ronchi
> http://www.soasi.com
>
> Hobby & Giochi
> http://hobbygiochi.com
> http://www.facebook.com/hobbygiochi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> 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 django-us...@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